For some time now I've been mirroring a Subversion repository to a Git repository. Which has always worked fine. However, due to a crash of a virtual server and not having a backup I've got to setup the mirror again. The repository I need to track is almost 1200 commits big and contains a lot of files (which is the main reason for the Git mirror, as it's so much faster to checkout a copy of the repo).
What I need to do now is make my freshly cloned Git mirror make track the Subversion repository again. I've got no problems adding the new remote ref but can't seem to figure out how to be able to pull svn commits into the Git branch again.
One error I seem to receive is Unable to determine upstream SVN information from working tree history
.
How can I re-enable mirroring a Subversion repository on a existing Git branch that's only behind a couple commits from the Subversion repository?
The easiest way to get it to work again is to copy over the .git/svn
directory from the original, as this is where extra svn metadata are tracked (assuming the git-svn config is the same).
However, since you don't have it try this:
git svn init http://hostname/svn/repository
with any other parameters you used before (maybe -s
?)
git checkout
the latest commit from svn.
Recreate the git-svn
ref: git update-ref refs/remotes/git-svn HEAD
(or if you used -s
, this should be refs/remotes/trunk
instead)
Fetch the latest from svn since the current commit: git svn fetch --parent
. This should rebuild git-svn metadata for your entire history.
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