Migrating SVN to Git... Standard github instructions result in no files?
When I followed the standard github instructions to migrate svn to git using “git-svn”. When I tried:
$ git svn clone SVN_REPO_URL LOCAL_DIR
I’d appear like it was checking out files… it’d chug away for about 1000 commits and then just stop with no error messages. When i’d CD to my new git repo… there would be no files other then the .git database.
I’m not sure why this was… perhaps it’s cause our SVN repos are really old. I don’t really exactly know. But, here’s the procedure that worked for us. This guide was originally written for internal use so substitute “alertustech” for your username and “allert-eth” for your repo name. One other note to point out is our repos didn’t have tags or branches that we cared about. So, we omitted the -s or —stdlayout switches.
1) It’s assumed you already have local user configured, SSH keys generated and uploaded, etc.
2) Set up a local authors.txt file (in my case S:\GitRepos\authors.txt)
(NOTE: make this an absolute path, not a relative one)
Note2: If you get an error such as “could not lock config file /path/to/file/.gitconfig” alternatively you can append —authors-file=/path/to/file on the git svn fetch
I gather that “origin” and “master” are names for locations, or copies in this case - so what you’re doing here is calling “origin” the github copy, and “master” your existing copy, so pushing the master to the origin, and future clean checkouts will have the github copy as “origin”. At this point all the info should show up on the github page and you can begin using the repo as normal.
Special thanks to Phil Anderson for writing up these instructions.
UPDATE: Those instructions are a little complicated… If you don’t have a big repo, you can probably get away with this:
$ mkdir PCB $ git svn init https://SVN_URL_TO_THE_FOLDER_IMPORTING —no-metadata $ git svn fetch —authors-file=/d/authors.txt $ git remote add origin https://github.com/yourhandle/yourrepo.git $ git push -u origin master
Reader Comments (2)
Thanks a lot,
Imran