14 janvier 2015

Moving Git repo to GitHub

Today I pushed my repl-tasks project to GitHub, whose repository was previously on a personal Synology server.

# add the new repo on GitHub
git remote add new-origin [email protected]:obarbeau/repl-tasks.git
# push everything
git push --all new-origin
git push --tags new-origin
# rename old syno repo
git remote rename origin previous-on-syno
# rename new repo to master
git remote rename new-origin origin
# change destination of local master branch to new repo
git branch master --set-upstream-to=origin/master

The history is preserved.

If some branches had existed, it would have been necessary to pull them first to the local repo and then push them to the new one.

See this post for more information.

This project needs some refactoring and documentation, I'll do it ASAP...

Tags: github git