Unable to determine upstream SVN information from HEAD history

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

Why do I get this error message?

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

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

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

    Another cause for this problem is a wrong svn-remote.svn.rewriteRoot option (see this answer for instructions on using this).

    The git-svn-id line in your commits imported from Subversion has to match the rewriteRoot URL if it is set.

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

    I got this message because I used a FQDN for the git svn init command but the pre-existing git-svn integration was using just the hostname.

    E.g. grep git-svn-id showed:

    git-svn-id: svn://host/repo/...
    

    But I did:

    git svn init -Ttrunk svn://host.domain.com/repo
    

    (We have a machine that regularly syncs a git repo with svn, then everyone else has git config --add remote.origin.fetch refs/remotes/*:refs/remotes/* to fetch down the svn synced branches.)

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

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