Unable to determine upstream SVN information from HEAD history

后端 未结 11 884
忘掉有多难
忘掉有多难 2020-12-02 10:28

Why do I get this error message?

相关标签:
11条回答
  • 2020-12-02 10:53

    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.

    0 讨论(0)
  • 2020-12-02 10:56

    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.)

    0 讨论(0)
  • 2020-12-02 11:01

    (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.

    0 讨论(0)
  • 2020-12-02 11:03

    Another possible cause: If you have an svn-remote..rewriteUUID config set, git-svn may have trouble locating the right meta-data for the repository. For example, you might have something like this (see the git-svn man page for a discussion of why you would want to do this):

    [svn-remote "svn"]
        url = svn://read-write.test.org
        fetch = trunk/project:refs/remotes/trunk
        rewriteRoot = http://read-only.test.org/svn
        rewriteUUID = 1234-abcd
    

    ... where 1234-abcd is the UUID of the read-only mirror. When you 'git svn fetch', you might end up with this file:

    .git/svn/refs/remotes/trunk/.rev_map.5678-dcba
    

    ... where 56780-dcba is the UUID of the read-write repository. The fix is to:

    $ mv .git/svn/refs/remotes/trunk/.rev_map.5678-dcba \
        .git/svn/refs/remotes/trunk/.rev_map.1234-abcd
    

    Can't say for certain whether that is a durable solution, i.e., it might get confused next time you 'git svn fetch'. Might try a symlink rather than 'mv', I haven't experimented with that.

    0 讨论(0)
  • 2020-12-02 11:04

    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.
    0 讨论(0)
  • 2020-12-02 11:04

    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
    
    0 讨论(0)
提交回复
热议问题