Move repo and all branches and tags from one repo to other

#!/bin/bash

REPO_FROM=git@github.com:sourcebroker/imageopt.git
REPO_TO=git@github.com:sourcebroker/imageopt_new.git

mkdir repomove
cd repomove
git clone --bare ${REPO_FROM} .git
git config --unset core.bare
git reset --hard
git remote rename origin old-origin
git remote add origin ${REPO_TO}
git push -u origin --all
git push -u origin --tags