git svn clone 在 OSX 死于信号 11

git svn clone died of signal 11 on OSX

我正在尝试将一个项目从 svn 迁移到 git。我使用的是 osx svn 包,但我也尝试使用自制软件安装。我一直收到同样的错误。

git svn clone http://myserver/myrepo
error: git-svn died of signal 11

版本信息:

git --version
git version 2.2.1

svn --version
svn, version 1.7.17 (r1591372)
   compiled Sep 18 2014, 13:06:44

我是 运行 Yosemite。

git svn 执行 git-svn,这是一个使用绑定到 libsvn 的 Perl 程序,这些绑定很敏感。如果 Perl 更改或 SVN 更改,则可能会导致段错误。两者都可能发生在 OS 升级中。

找出您的 git 使用的 SVN 绑定版本。这是我得到的 OS X 10.10.1

$ /usr/bin/git svn --version
git-svn version 1.9.3 (Apple Git-50) (svn 1.7.17)

按照@MykolaGurov 在评论中的建议尝试brew upgrade git。好像有fixes for 10.10 and git-svn。您也可以尝试 brew reinstall subversion --with-perl 重新安装 Perl 绑定。

或者使用 OS X 提供的 /usr/bin/git 将使用 OS 提供的 SVN 和 Perl 构建。

或尝试 MacPorts,我使用它并且它的 git-svn 有效。 port install git +svn.

首先要做的是调试 git 命令,通过添加 GIT_TRACE=1 查看它在哪个组件上失败,例如

$ GIT_TRACE=1 git svn clone https://example.com/svn/foo/ foo
21:12:40.239238 git.c:557               trace: exec: 'git-svn' 'clone' 'https://example.com/svn/foo/ foo/' 'foo'
21:12:40.240158 run-command.c:347       trace: run_command: 'git-svn' 'clone' 'https://example.com/svn/foo/ foo/' 'foo'
error: git-svn died of signal 11

并重新 运行 损坏存储库中的最后一个命令,该命令显示崩溃发生在 git-svn 二进制文件中。

为此,您需要确定 git-svn 二进制文件的位置,例如

$ which -a git-svn
$ locate git-svn | grep git-svn$
/Applications/GitHub.app/Contents/Resources/git/libexec/git-core/git-svn
/Applications/SourceTree.app/Contents/Resources/git_local/libexec/git-core/git-svn
/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git-svn
/Library/Developer/CommandLineTools/usr/libexec/git-core/git-svn
/usr/local/libexec/git-core/git-svn
/usr/local/Cellar/git/1.8.4.1/libexec/git-core/git-svn
/usr/local/Cellar/git/2.4.0/libexec/git-core/git-svn

如果您有多个 git-svn 个二进制文件,要找出使用了哪个,运行:

sudo fs_usage -f exec | grep git

在另一个终端中,然后 运行再次执行失败的 git 命令。

一旦你确定了git-svn你运行,运行它直接喜欢:

/usr/local/libexec/git-core/git-svn ...
/usr/local/Cellar/git/2.4.0/libexec/git-core/git-svn 

无论您指定哪个参数,它很可能会崩溃,否则请按照跟踪输出所示进行指定。

有时它可能是一个符号 link,因此请检查它指向的位置,例如:

$ stat /usr/local/libexec/git-core/git-svn
  File: ‘/usr/local/libexec/git-core/git-svn’ -> ‘/Applications/GitHub.app/Contents/Resources/git/libexec/git-core/git-svn’

如果是这种情况,请将符号 link 更改为不会崩溃的符号,例如

$ ln -vfs /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git-svn /usr/local/libexec/git-core/git-svn 
‘/usr/local/libexec/git-core/git-svn’ -> ‘/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git-svn’

或者确定您的 git-svn 属于哪个软件包并进行相应升级,例如

  • /Applications/Xcode.app -> 升级 Xcode,
  • /Applications/GitHub.app -> 升级GitHub应用程序
  • /usr/local/Cellar/git -> 通过 Homebrew 升级 git,例如

    brew upgrade git
    

    如果 Homebrew 会抱怨文件冲突,那么 运行:

    brew link --overwrite git
    

如果升级后仍然崩溃,请使用不会崩溃的不同版本(如上所述),例如

/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git-svn clone https://example.com/svn/foo/ foo

如果这对您有用,请添加到您的 PATH 并稍后使用 git-svn 命令,或添加别名,例如:

alias git-svn='/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git-svn'

如果您缺少任何新 git-svn 的依赖项,请通过 运行ning 安装 Git::SVN

sudo cpan install Git::SVN

调试

如果上述方法无效,您可以进一步调试。以下是在单独的终端中对 运行 的一些建议,然后在 运行 中的失败命令:

sudo dtruss -fn git

或:

sudo dtruss -fn git-svn

要识别哪个 git-svn 被调用,您可以尝试:

  • sudo /usr/bin/newproc.d
  • sudo fs_usage -f exec | grep git

我的情况不同。我在 https url 中为我的 svn 存储库指定了凭据。 删除凭据解决了问题。

我如何运行命令

git svn https://<key>:<pass>@example.com/repo

删除了 key/pass 命令通过。