Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to determine upstream SVN information from HEAD history

Tags:

git

git-svn

i got this message because of cloning the svn repo with --no-metadata option. Maybe that's the case with Your problem too.

When cloning it without that option everything is fine.

The --no-metadata option is meant to clone an SVN repository when the new git clone is to be come the canonical source in the future. It lacks the capacity to commit back to the SVN upstream, because it has no way to track differences between the git clone and the SVN upstream.


(Posted Chad's "question" as an answer, fixed formatting and typos.)

There are a couple of causes for this error message.

The first, being the most common. You have two disjoint histories in your git repository: The history that you made in git, and the history from the remote svn repository.

To fix this, you need to make your git repository and svn repository share one common ancestor so git can figure what commits have changed what.

The following Article, discusses how to fix the problem:

The second possible cause of the problem is if you have an early version of git (possible, windows msysGit package) and you have just created a new git repository that communicates with a remote svn repository.

For example:

git svn init svn://svn.xxx.xxx/xxx/trunk
git svn fetch -r BASE:10

or

git clone svn://svn.xxx.xxx/xxx/trunk // Adds all the files in the revision...

And you get the follow error messages, when using the following commands.

git svn info

Unable to determine upstream svn information from working tree or

git svn rebase

unable determine upstream svn information working tree history or

  git svn dcommit

Unable to determine upstream SVN information from HEAD history

If you get the above error messages, first step is to check your git version. If your running a older git version <= 1.6.3.3.* that was in my case with (msysGit), then the easiest way to fix the problem is to update to a newest version of git such as 1.6.4.*.

The following Article discusses the problem in more detail.


In my case, the HEAD from the svn repo should have been matched to the HEAD from the git repo. This should solve the problem:

git update-ref refs/remotes/git-svn refs/remotes/origin/master

If your use a different git branch for svn trunk, for example svntrunk, that branch should be referenced instead, that is:

git update-ref refs/remotes/git-svn refs/remotes/origin/svntrunk

I got this message after I incorrectly added the -s/--stdlayout parameter to the git svn clone command for a Subversion repo that did not have the "standard Subversion layout" of trunk, tags, and branches relative paths.

(The Subversion repos I usually clone do have the standard relative paths, so when I cloned a Subversion repo that didn't have them using my usual git svn clone command, I got this cryptic message. The message is 100% correct, but almost 100% useless when trying to figure out what the problem is.)


You may also get this error, when you have checkout freshly created SVN repo.

I have solved this by

  1. First doing an initial commit via svn command
  2. Then clone the repo using git svn command.

got same problem, here is solution based on http://eikke.com/importing-a-git-tree-into-a-subversion-repository/ article:

$ git svn init http://server.com/svn/project/trunk/prototypes/proto1/
$ git svn fetch
  W: Ignoring error from SVN, path probably does not exist: (160013): Filesystem has no item: '/svn/!svn/bc/100/dcom/trunk/prototypes/ws' path not found
  W: Do not be alarmed at the above message git-svn is just searching aggressively for old history.
  This may take a while on large repositories
  r147367 = 37c9910f794cb9cff7ca0d5d2eb26e1f0dabbc4d (refs/remotes/git-svn)
$ svn log http://server.com/svn/project/trunk/prototypes/proto1/
  ------------------------------------------------------------------------
  r147367 | user | 2014-01-16 18:02:43 +0100 (Thu, 16 Jan 2014) | 1 line
  proto1 home
  ------------------------------------------------------------------------
$ git log --pretty=oneline master | tail -n1
  71ceab2f4776089ddbc882b8636aacec1ba5e832 Creating template
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #1

$ git show-ref git-svn
  37c9910f794cb9cff7ca0d5d2eb26e1f0dabbc4d refs/remotes/git-svn
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #2

$ echo "71ceab2f4776089ddbc882b8636aacec1ba5e832 37c9910f794cb9cff7ca0d5d2eb26e1f0dabbc4d" >> .git/info/grafts

$ git svn dcommit
  Committing to http://server.com/svn/project/trunk/prototypes/proto1 ...
    A   README.md
    A   pom.xml
A   src/main/java/.gitkeep
A   src/main/resources/.gitkeep
A   src/main/webapp/WEB-INF/web.xml
A   src/main/webapp/index.html
A   webapps/.gitkeep
  Committed r147419
    A   README.md
    A   pom.xml
A   src/main/java/.gitkeep
A   src/main/resources/.gitkeep
A   src/main/webapp/WEB-INF/web.xml
A   src/main/webapp/index.html
A   webapps/.gitkeep
  r147419 = 6a8bda7262739306d0a6e17eaad2802737dedc35 (refs/remotes/git-svn)
  No changes between current HEAD and refs/remotes/git-svn
  Resetting to the latest refs/remotes/git-svn
  Unstaged changes after reset:
    M   pom.xml
    M   src/main/webapp/index.html
    A   .gitignore
  Committed r147420
    M   pom.xml
    M   src/main/webapp/index.html
    A   .gitignore
  r147420 = 749b5acec55c341672bca08d07de8c336b5a4701 (refs/remotes/git-svn)
  No changes between current HEAD and refs/remotes/git-svn
  Resetting to the latest refs/remotes/git-svn
  ...etc...