Monthly Archives: February 2019

Git change remote repo

Sometimes you start a git repo and some time later, you have to change your remote repo. This can be done really easy with a small catch:

Your new repo should be completely clean.

git remote -v
git remote set-url origin<NEW_USER>/<NEW_REPO_NAME>.git
git merge --allow-unrelated-histories FETCH_HEAD

This will work now:

git push

… and will transfer your old repo’s history to the new repo.