Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git-svn: Unable to determine upstream SVN information from working tree history

Tags:

git

svn

git-svn

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?

like image 880
Tim Avatar asked Nov 18 '13 23:11

Tim


2 Answers

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.

like image 65
Kevin Kuszyk Avatar answered Sep 18 '22 12:09

Kevin Kuszyk


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.

like image 33
VonC Avatar answered Sep 19 '22 12:09

VonC