I basically followed this howto to migrate an old, very big SVN repository to git. This does not work as expected. Here is an example excerpt from my checkout living in ~/git/old_svn_repo
(done with git svn
but without --no-metadata
):
remotes/origin/trunk
remotes/origin/branchX
remotes/origin/branchY # and many more
Next step is step 4, which seemed to work flawlessly. I pushed to the bare repository (note I used ~/git/new-bare.git
instead of ~/new-bare.git
):
git init --bare ~/git/new-bare.git
cd ~/git/new-bare.git
git symbolic-ref HEAD refs/heads/trunk
cd ~/git/old_svn_repo
git remote add bare ~/git/new-bare.git
git config remote.bare.push 'refs/remotes/*:refs/heads/*'
git push bare
This got me a lot of output like
* [new branch] origin/trunk -> origin/trunk
* [new branch] origin/foo-> origin/foo
* [new branch] origin/bar-> origin/bar
Next is step 5 where you are supposed to rename trunk
to master
:
cd ~/git/new-bare.git
git branch -m trunk master
Here the problem starts:
I enter:
git branch -m trunk master
I get:
error: refname refs/heads/trunk not found
fatal: Branch rename failed
Doing git branch -a
reveals that all branches are prefixed with origin/
.
What did I do incorrectly here and how do I get that right?
After several failed attempts at this (I had the same issue, an extra directory named origin in the refs/remotes path.) I made it work with this minor tweak.
git config remote.bare.push 'refs/remotes/origin/*:refs/heads/*'
Additionally in the create .gitignore step I used:
git svn show-ignore -i origin/trunk > .gitignore
Which worked as intended.
I'm not sure where the extra origin dir comes from in this, but these mods worked for me.
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