If you’re working an open-source projects, these days you can barely get around Git and GitHub. Actually getting started, especially on Windows, isn’t trivial. In my case I had some projects I need to transfer from a Google Code subversion repository to a new repository at GitHub. Actually getting started with GitHub needs to wait for another post, but here are some commands for importing from Subversion:
git svn clone http://[yourproject].googlecode.com/svn/trunk/path/to/code/ git remote add origin email@example.com:[youraccount]/[yourrepository].git git push origin master
This will create a new folder, based on the svn url you provide (the last part will provide the folder name) and get the files from that path, including the history(!). The second command tells the local Git repository where the next command should go to. You have to replace that URL with “Your clone URL” from your GitHub project.
The last command actually pushes the code to the repository. For that to work, the GitHub repository should be brand-new and empty. If you tried GitHub’s SVN import and got nothing, the repository may be filled with something that GitHub doesn’t show. In that case, create a new repository and import into that. You can remove/delete later.
The following code should do mostly the same, but instead of creating a folder, will initialize an empty repository in the current folder, then do the checkout from svn into that folder (need to test that again):
git init git svn clone http://[yourproject].googlecode.com/svn/trunk/path/to/code/ . git remote add origin firstname.lastname@example.org:[youraccount]/[yourrepository].git git push origin master
Note the dot after the svn clone command.
Thanks to Kelvin Luck for the ideas and commands!