git svn 克隆在 OSX 上死于信号 11



我正在尝试将项目从 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

我正在经营优胜美地。

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

找出您的 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。 似乎有针对 10.10 和 git-svn 的修复程序。 您也可以尝试brew reinstall subversion --with-perl重新安装 Perl 绑定。

或者使用OS X提供的/usr/bin/git,它将使用操作系统提供的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 

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

有时它可能是一个符号链接,所以检查它指向的位置,例如:

$ 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’

如果是这种情况,请将符号链接更改为未崩溃的链接,例如

$ 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 -> 通过自制软件升级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的任何依赖项,请通过运行以下命令安装 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 网址中指定了我的 svn 存储库的凭据。删除凭据解决了问题。

我如何运行命令

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

删除了密钥/传递,命令传递。

最新更新