I published a post before on How To Create a Remote Shared Git Repository and have recently seen people asking on how to then transfer those kind of repositories to Github. Seriously, this is a one-liner!
Of course we all love Github, with the Issues feature, a Wiki section and a full-blown visual interface to your Git repositories, so sooner or later you might want to switch from your self-hosted Git repository to Github. It turns out that it’s one of the easiest things to do, yet another reason to love Git ;)
So assuming you’re in your Git project directory on your local machine, you’ve committed your latest changes and pushed them to your remote Git repository. Assuming also that you got yourself a new Github-hosted repository, here’s what you need to do to move over:
$ git push --mirror git@github.com:username/project.git
And that’s it, my oh my! Really, that was simple. Now if you want to completely move over to Github then go edit your Git settings (it’s a file called config in the .git directory under the root of your project) and find the line that says “url =”, change the URL to that very same git@github.com:username/project.git and save the file.
And.. Congratulations, you’re done! What? Were you expecting more? ;)
[…] it is that easy. Kudos to Konstantin for the tip. […]
What does the –mirror option do? Github instructs the same command, but without the –mirror and with defining a remote beforehand.
Also, what does changing that files url= do? What would it effect?
Thanks!
Nick it would mirror the push to a different repository without switching to it. Perhaps the add origin does what url= does in this case, so yeah Github's is probably easier ;)