bst*_*rre 34

(发布Chad的"问题"作为答案,修复格式和拼写错误.)

此错误消息有几个原因.

第一,是最常见的.您的git存储库中有两个不相交的历史记录:您在git中创建的历史记录,以及远程svn存储库中的历史记录.

要解决这个问题,你需要让你的git存储库和svn存储库共享一个共同的祖先,这样git可以知道哪些提交已经改变了什么.

以下文章讨论了如何解决问题:

这个问题的第二个原因可能是,如果你有git的(可能的,窗户msysGit包)的早期版本,您刚才创建与远程SVN仓库通信的Git仓库.

例如:

git svn init svn://svn.xxx.xxx/xxx/trunk
git svn fetch -r BASE:10
Run Code Online (Sandbox Code Playgroud)

要么

git clone svn://svn.xxx.xxx/xxx/trunk // Adds all the files in the revision...
Run Code Online (Sandbox Code Playgroud)

当您使用以下命令时,您会收到以下错误消息.

git svn info
Run Code Online (Sandbox Code Playgroud)

无法从工作树或工作树确定上游svn信息

git svn rebase
Run Code Online (Sandbox Code Playgroud)

无法确定上游svn信息工作树历史或

  git svn dcommit
Run Code Online (Sandbox Code Playgroud)

无法从HEAD历史记录中确定上游SVN信息

如果您收到上述错误消息,请第一步检查您的git版本.如果您运行的较旧的Git版本<= 1.6.3.3.*这是在我的情况与(msysGit),然后来解决这个问题最简单的办法是更新到混帐如1.6.4的最新版本.*.

以下文章更详细地讨论了该问题.


小智 32

我得到这条消息是因为用--no-metadata选项克隆了svn repo .也许你的问题也是如此.

在没有这个选项的情况下克隆它一切都很好.

--no-metadata选项旨在克隆SVN存储库,当新git克隆将来成为规范源时.它缺乏返回上游SVN的能力,因为它无法跟踪git clone和SVN上游之间的差异.


axe*_*l22 17

在我的例子中,来自svn repo的HEAD应该与git repo中的HEAD匹配.应该解决问题:

git update-ref refs/remotes/git-svn refs/remotes/origin/master
Run Code Online (Sandbox Code Playgroud)

  • 这并没有解决我的问题. (5认同)
  • 错误:致命:引用/远程处理/来源/母版:无效的SHA1 (2认同)

Ed *_*der 9

我得到这个消息后,我错误地添加的-s/ --stdlayout参数的git svn clone命令为没有一个Subversion回购具有的"标准的Subversion布局" trunk,tagsbranches相对路径.

(我通常克隆的Subversion repos确实有标准的相对路径,所以当我克隆一个没有使用我常用git svn clone命令的Subversion repo时,我收到了这个神秘的消息.消息100%正确,但几乎100%没用当试图找出问题所在.)


小智 8

当您有结帐新创建的SVN回购时,您也可能会收到此错误.

我已经解决了这个问题

  1. 首先通过svn命令进行初始提交
  2. 然后使用git svn命令克隆repo.


and*_*rej 8

遇到同样的问题,这里是基于http://eikke.com/importing-a-git-tree-into-a-subversion-repository/文章的解决方案:

$ 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...
Run Code Online (Sandbox Code Playgroud)