【问题标题】:Git push over SSH fails with Broken pipeSSH 上的 Git 推送因管道损坏而失败
【发布时间】:2018-01-23 00:07:13
【问题描述】:

我在内部服务器上有一个无法再推送到的远程 git 存储库:

% git push
Broken pipe

直到几周前,它都运行良好(本月我刚刚尝试了第一次推送)。

我可以 ssh 很好:

% ssh sol date
Mon Jan 22 15:23:33 PST 2018

我启用了 GIT_TRACE=2 并看到了这个:

% git push
16:00:52.629043 git.c:344               trace: built-in: git 'push'
16:00:52.643399 run-command.c:626       trace: run_command: 'ssh' 'sol' 'git-receive-pack '\''/vol/git/cmb.git'\'''
16:00:52.991631 run-command.c:626       trace: run_command: 'pack-objects' '--all-progress-implied' '--revs' '--stdout' '--thin' '--delta-base-offset' '--progress'
Broken pipe

这是否意味着它试图在本地或远程主机上运行“pack-objects”? “pack-objects”是否应该是默认 $PATH 中的可执行文件?没看到:

% which pack-objects
pack-objects: Command not found.

本地系统是Windows 10 + Cygwin + git 2.15.1 远程系统是 RHEL 7 + git 2.15.1。 git install 来自 ius 并使用默认路径,因此 /bin/git 位于默认 $PATH 中。

尽管我认为它只影响 HTTP,但我确实尝试过:

% git config http.postBuffer 52428800
16:00:49.671332 git.c:344               trace: built-in: git 'config' 'http.postBuffer' '52428800'

我还尝试了“git fetch”,但出现错误:

% git fetch
10:08:37.458683 git.c:344               trace: built-in: git 'fetch'
10:08:37.756135 run-command.c:626       trace: run_command: 'ssh' 'sol' 'git-upload-pack '\''/vol/git/cmb.git'\'''
10:08:39.441934 run-command.c:626       trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet'
10:08:39.737251 run-command.c:626       trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet'
error: sol:/vol/git/cmb.git did not send all necessary objects

10:08:40.226984 run-command.c:626       trace: run_command: 'gc' '--auto'

【问题讨论】:

  • git fetch 有用吗?
  • 刚试过 git fetch (见修改后的帖子),它失败并出现不同的错误。

标签: git ssh


【解决方案1】:

要排除任何客户端问题,请尝试使用相同的命令:

【讨论】:

    【解决方案2】:

    默认情况下,RHEL 7 附带较旧的 Git。也许您的 2.15.1 安装不在标准路径中,而是使用 .profile 或其他在非交互式 SSH 期间未调用的 shell 机制添加到 $PATH?如果是这种情况,请尝试使用

    git push --receive-pack=/path/to/git-receive-pack
    

    在交互式 SSH 会话期间确定远程上的正确路径之后。

    【讨论】:

      【解决方案3】:

      问题似乎出在客户端上的 Cygwin git install 上。如果我按照建议安装适用于 Windows 2.16.1 的 Git(谢谢 VonC!),那就可以了。因此,Cygwin git 出了问题。

      【讨论】:

        猜你喜欢
        • 2023-03-13
        • 1970-01-01
        • 1970-01-01
        • 2012-02-22
        • 1970-01-01
        • 1970-01-01
        • 2016-01-08
        • 2016-11-03
        • 2011-07-13
        相关资源
        最近更新 更多