Unable to determine upstream SVN information from HEAD history

Viewed 46845

Why do I get this error message?

11 Answers

I saw this after I used BFG Repo-Cleaner https://rtyley.github.io/bfg-repo-cleaner/ and rewrited git history (intentional), and then tried to git svn fetch again. The message shows that the git <-> svn matching is lost.

To solves this, read https://git-scm.com/docs/git-svn
At the very bottom shows:

$GIT_DIR/svn/*/.rev_map.

Mapping between Subversion revision numbers and Git commit names. In a repository where the noMetadata option is not set, this can be rebuilt from the git-svn-id: lines that are at the end of every commit (see the svn.noMetadata section above for details).

You need to have the git-svn-id comments in the commit comments to do this. If you do, you can delete the .rev_map.* file and rebuild it.

rm .git/svn/refs/remotes/git-svn/.rev_map.*
git svn info

This should show:

Rebuilding .git/svn/refs/remotes/git-svn/.rev_map.{snip} ...
...
Done rebuilding .git/svn/refs/remotes/git-svn/.rev_map.{snip}
Path: .
...and then regular git svn info output

It happened to me too. And I don't remember to have done something unusual. SVN repo existed, Git version was the most recent. There were 2 commits in local git repo that I wanted to commit to SVN. But when I ran:

git svn dcommit

I got the error.

git svn fetch

and

git svn rebase

didn't help. I got the same error after running them.

I think the problem could be caused by the fact that I did a squash of 2 local git commits previously. If it was the reason I still don't understand why a squash is a problem in this case (If you know, please, comment it).

Anyway I solved the problem by cloning the svn repo again to another working directory.

git svn clone .../trunk

Added the problematic git repo as a remote one:

git remote add last /cygdrive/c/data/problem_repo

and did a cherry-pick on all the commits that weren't yet moved to SVN. After that I could successfuly run:

git svn dcommit
Related