10

I am trying to migrate a SVN project to git with thel help of svn2git. When executing the command it exits with the following error:

Running command: git branch --track "0.0.9" "remotes/svn/0.0.9"
fatal: Cannot setup tracking information; starting point 'remotes/svn/0.0.9' is not a branch. 

Started it with:

 svn2git http://<host>/<project>

I can't find any solution for it and it seems not many users has the same problem.

What can I do to solve this problem?

pderaaij
  • 1,337
  • 12
  • 32

4 Answers4

7

I had the same problem using Debian Sid (the version of "git" is 1:1.8.3.2-1). Before I already failed on Debian Squeeze using the stock "git" package (1:1.7.2.5-3). Finally I ended up using the squeeze-backport repository (1:1.7.10.4-1~bpo60+1), and now it works.

What version of Git are you using?

stucki
  • 104
  • 2
  • I ran into the same problem, git 1.8.1.3 works fine but updating to 1.8.3.3 generates the mentioned error. – Blair Zajac Aug 15 '13 at 16:44
  • Sorry, for the late reaction. Downgrading to a 1.7 works for me also. Thanks for your answer! – pderaaij Aug 23 '13 at 12:59
  • I also needed to downgrade from git 1.8.4 to 1.7.12.4 for the tracking to work. Doing this with Homebrew was easy enough: `cd /user/local/Library/Formula && git checkout 7f1a8c0 /usr/local/Library/Formula/git.rb && brew unlink git && brew install git`. – Asbjørn Ulsberg Aug 27 '13 at 12:02
  • I have the same problem with Homebrew-installed git 1.8.4. Using Apple-installed /usr/bin/git 1.8.3.1 let me create the tracking branches. – Jay Lieske Aug 28 '13 at 00:00
  • Thank you for the great information. Had the same issue, was using v1.8.4 – Sajid Ali Sep 17 '13 at 12:25
  • 2
    Git 1.8.3.1 is the last version that works with the current release 2.2.2 of svn2git. A few days ago a fix was integrated into svn2git, but there's no official release yet. [Here's the GitHub issue](https://github.com/nirvdrum/svn2git/issues/132)] if you want to look into it (apparently the fix is pretty simple, just a command line option of `git branch` that needed to be removed). – herzbube Oct 08 '13 at 21:07
  • 1
    @Jason McCreary I'm glad that it works now for you, happy migrating to Git =) –  Jan 02 '14 at 21:10
  • @pderaaij normally my answer should be accepted because using an older Git release is not the solution ;-) –  Feb 21 '14 at 14:40
7

this should fix it:

Changing this line https://github.com/nirvdrum/svn2git/blob/master/lib/svn2git/migration.rb#L319
from run_command("git branch --track \"#{branch}\" \"remotes/svn/#{branch}\"")
to run_command("git branch \"#{branch}\" \"remotes/svn/#{branch}\"") should fix it.

At least it works now for me without any issues.

you can find the migration.rb file on Windows under C:\Ruby200-x64\lib\ruby\gems\2.0.0\gems\svn2git-2.2.2\lib\svn2git or something like this

https://github.com/nirvdrum/svn2git/issues/132#issuecomment-31453436

  • This is still necessary on Ubuntu 14.04, so presumably a new release hasn't been push to wherever gem install downloads packages from. – 6EQUJ5 May 08 '14 at 03:28
  • I don't know why there is no new release but they should push one to solve the problem. But I, personally, think the solution which I have mentioned is the best solution and should work on all systems and be compatible with them. But I didn't test this. –  May 08 '14 at 15:37
  • I updated my svn2git and it fixed the issue. `gem update svn2git` – Nate Jun 24 '14 at 21:09
  • 1
    right Nate, this is now officially fixed and released –  Jun 25 '14 at 18:22
2

I would like to add a quick and dirty solution to this without changing code!

Every time you get the error, just manually change branch and continue your svn2git command.

so to go through the workflow:

Running the command

svn2git ....

Got the error

Running command: git branch --track "0.0.9" "remotes/svn/0.0.9"
fatal: Cannot setup tracking information; starting point 'remotes/svn/0.0.9' is not a branch. 

Manually change branch (Copy the Running command: line and removing --track)

branch "0.0.9" "remotes/svn/0.0.9"

Continuing with svn2git

svn2git ...

note ... after the svn2git above is whatever your svn2git command is

Angel.King.47
  • 7,922
  • 14
  • 60
  • 85
  • this can take a while when you have many branches and have to do this manually instead of changing the code (so it works always) –  May 08 '14 at 15:33
1

If you have a small number of branches and don't want to downgrade git, here's a way to workaround the issue. Run "git branch -r" to get a list of the branches. Then run the following for each branch (named svn/next_branch for example):

$ git branch "next_branch" "remotes/svn/next_branch"

The only difference is the "--track" option is removed.

That was the fix applied for this Github Issue

Brad Pitcher
  • 1,693
  • 17
  • 21