Git

Using svn2git on OS X Leopard

I was trying to import the subversion repository for our central application to git tonight, and I ran into some problems.
First, I tried to install the svn2git gem, but i kept getting:

ERROR:  could not find gem svn2git locally or in a repository

and James Coglan doesn’t have github gems enabled on the repository. So I had to clone the repository and install the gem manually.

% git clone git://github.com/jcoglan/svn2git.git
Initialized empty Git repository in /Users/pjdavis/ruby/svn2git/.git/
remote: Counting objects: 46, done.
remote: Compressing objects: 100% (28/28), done.
remote: Total 46 (delta 14), reused 46 (delta 14)
Receiving objects: 100% (46/46), 6.79 KiB, done.
Resolving deltas: 100% (14/14), done.

% rake gem
(in /Users/pjdavis/ruby/svn2git)
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/gempackagetask.rb:13:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009.
mkdir -p pkg
WARNING:  no rubyforge_project specified
WARNING:  deprecated autorequire specified
Successfully built RubyGem
Name: svn2git
Version: 1.0.0
File: svn2git-1.0.0.gem
mv svn2git-1.0.0.gem pkg/svn2git-1.0.0.gem

% sudo gem install pkg/svn2git-1.0.0.gem
Successfully installed svn2git-1.0.0
1 gem installed
Installing ri documentation for svn2git-1.0.0...
Installing RDoc documentation for svn2git-1.0.0...

Sweet. So let’s try this thing out. Following the README file, I try

% svn2git http://svn.myserver.com/app
git: 'svn' is not a git-command. See 'git --help'.
git: 'svn' is not a git-command. See 'git --help'.
fatal: Not a git repository
fatal: Not a git repository

Well. Crap.

I do a bit more digging, and try to convert it the normal way, with git svn clone -s but get the same thing. As it turns out, according to Fat Penguin, when I installed git-core from MacPorts i didn’t use the +svn flag, so git-svn wasn’t installed with the rest of git. So here I go back MacPorts and

% sudo port deactivate git-core @1.6.0.2_2+doc
--->  Deactivating git-core @1.6.0.2_2+docs
% sudo port install git-core +svn
....bunch o' install crap....
--->  Activating git-core @1.6.0.5_0+doc+svn
--->  Cleaning git-core

and finally…

% svn2git http://svn.myserver.com/app

and BOOM! my svn repo is cloned into my current directory. Unfourtnatlly my current directory happend to be my projects directory. so i had app, config, db, etc… in the same folder as the rest of my projects. But after a little cleanup I had a git repository ready to work in, with my subversion logs still intact.

speak up

Add your comment below, or trackback from your own site.

Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*Required Fields