I'm trying to sync my svn repository to git on a daily basis. After much reading, I was able to make this work by manually creating the following in my .git/config:
[svn-remote "svn"]
url = svn+ssh://svn.myserver.com/project/trunk
fetch = apps/ios/project:refs/remotes/mirror/project
I then created a branch based on this code and pushed it to the git repo with:
git checkout -b mirror/project mirror/project
git svn rebase
git push
I was very happy until I thought I'd really make sure this actually worked by deleting the cloned repo from disk and cloning it again, then trying to push some updates from svn.
git clone [email protected]:myproject
git checkout mirror/project
git svn rebase
This gives me the following error: Unable to determine upstream SVN information from working tree history
I've read the myriad posts on stackoverflow about this message, but I've yet to understand any of the solutions. Is it possible to explain in terms a git newbie could understand why git has chosen to forget all about my svn config?
The following commands got my fresh clone re-connected to Subversion:
git svn init https://svn.myserver.com/project -s
git update-ref refs/remotes/origin/trunk refs/remotes/origin/master
git svn rebase
It seems that updating the refs was the missing step.
I don't see how a simple "git clone" could know about your svn upstream repo information.
You have stored the svn-remote
in your .git/config
. And that local config is not cloned when you are cloning a repo (as I mention in "Is it possible to clone git config from remote location?").
Unless you do a git svn clone
or put again that svn-remote
information in your repo, you won't have access to your initial information.
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