I'm trying to migrate a project from SVN to git. This is the command I use:
$ git svn clone http://oursvnserver/ --no-metadata -A ../authors-transform.txt --trunk=path/to/trunk --branches=path/to/branches --tags=path/to/tags . --username=mysvnusername --prefix=origin/
The current directory is the directory that I want to become a repository. authors-transform.txt
is most definitely in the right location. The project uses the standard layout, but it does not exist at the root of the repository. (Unfortunately, someone long ago started the practice of just stuffing all projects into the same repository. That's why I specify --trunk
, --branches
, and --tags
.) It seems to check out fine. Then I try to generate an ignore file and get this incredibly cryptic error:
$ git svn show-ignore config --get svn-remote.svn.fetch :refs/remotes/git-svn$: command returned error: 1
It appears to be running some other command in the process, so I made some guesses:
$ git config --get svn-remote.svn.fetch :refs/remotes/git-svn || echo $? 1 $ git config --get svn-remote.svn.fetch :refs/remotes/git-svn$ || echo $? 1
So maybe I'm guessing right about what command it's calling? But that doesn't really help.
What does this error actually mean? What can I try to resolve it?
Using msysgit 1.9.4.
So this is caused by git not being able to find a matching fetch
entry in the svn-remote
section of the $GIT_DIR/config
file. Without an argument to git svn show-ignore
, it doesn't know what to look for in that section. (Maybe my tracking isn't set up right?)
To deal with this, you need to first specify which remote you want it to look at:
git svn show-ignore --id=origin/trunk
(Note that I specified the "origin" prefix when performing the clone. Vary your command accordingly.)
Secondly, this still failed with a very similar error for my branches. It worked fine for trunk, but not branches. This is because there was no fetch
entry for the branches. To add them, use this command (with adjustments for prefix):
git config --add svn-remote.svn.fetch path/to/branches/branchname:refs/remotes/origin/branchname
To see all the fetch
entries and make sure it worked:
git config --get-all svn-remote.svn.fetch
I'm not sure why only an entry for trunk is set in the beginning; maybe I did something wrong with the clone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With