GitHub
Update: Since I wrote this, I found out the git-svnimport is deprecated. The good news is that the process is now much easier!
I started importing a bunch of our Rails plugins into GitHub this morning.
A couple of issues proved problematic:
- Our plugins were in a single svn repository and not the typical trunk and branches setup:
rails/plugins/acts_as_audited rails/plugins/acts_as_geocodable … rails/plugins/with_action
This is totally fine with git svn. Don’t worry about it. I strongly recommend putting each plugin (or project) into its own git repository, as it will make your git life easier.To get this to work, you use the root of the repository as the path and pass -T with the path you want to fetch.
git svnimport -T plugins/acts_as_audited http://source.collectiveidea.com/public/rails
- Usernames in svn are stored just as our unix usernames (brandon, daniel). For git, I want to use our email addresses.
For that, you make a file of all the authors in the format
and pass -A path_to_author_fileusername = User's Full Name <email@addr.es>
git svnimport -T plugins/acts_as_audited -A ./authors http://source.collectiveidea.com/public/rails
git svn clone http://source.collectiveidea.com/public/rails/acts_as_audited -A ./authors
Finally, to save trouble, I want to create a new git repository. Trust me, its just easier. Pass in the path you want. -C some_path
git svnimport -C acts_as_audited -T plugins/acts_as_audited -A ./authors http://source.collectiveidea.com/public/rails
That’s it! After that, you have a git copy of your repository and can push it to GitHub, or do whatever you want.
Here’s the final command for reference (I added -v for verbose):
<del>git svnimport -v -C acts_as_audited -T plugins/acts_as_audited -A ./authors http://source.collectiveidea.com/public/rails</del>
<ins>git svn clone http://source.collectiveidea.com/public/rails/acts_as_audited -A ./authors </ins>
git svnimport -v -C acts_as_audited -T plugins/acts_as_audited -A ./authors http://source.collectiveidea.com/public/rails
git svn clone http://source.collectiveidea.com/public/rails/acts_as_audited -A ./authors
You may get some errors like W: Ignoring error from SVN, path probably does not exist:and
HTTP Path Not Found: REPORT request failed. These are fine. Ignore them.
Check out our projects on GitHub.
Comments
-
You really should use git-svn, not git-svnimport. The latter has been deprecated.
-
Kevin: Yep, I found out it was deprecated a couple days after posting this.
I hadn’t updated to git 1.5.4 yet, so I guess I should rework these instructions.