【发布时间】:2011-03-16 11:46:12
【问题描述】:
我在 Windows 上的 git 设置工作正常,直到几天前。我将 git 与 Cygwin 一起使用。一天早上,cygwin命令行“git pull”报如下错误。
当我连接到其他服务器时,SSH 工作正常。只有与 git 配合使用时,才会报上述错误而死。
Git 跟踪输出如下所示。
$ git pull
trace: exec: 'git-pull'
trace: run_command: 'git-pull'
trace: built-in: git 'rev-parse' '--git-dir'
trace: built-in: git 'rev-parse' '--show-toplevel'
setup: git_dir: .git
setup: worktree: c:/path/
setup: cwd: c:/path/
setup: prefix: (null)
trace: built-in: git 'ls-files' '-u'
setup: git_dir: .git
setup: worktree: c:/path/
setup: cwd: c:/path/
setup: prefix: (null)
trace: built-in: git 'symbolic-ref' '-q' 'HEAD'
setup: git_dir: .git
setup: worktree: c:/path
setup: cwd: c:/path
setup: prefix: (null)
trace: built-in: git 'config' '--bool' 'branch.master.rebase'
trace: built-in: git 'rev-parse' '-q' '--verify' 'HEAD'
setup: git_dir: .git
setup: worktree: c:/path
setup: cwd: c:/path
setup: prefix: (null)
trace: built-in: git 'fetch' '--update-head-ok'
trace: run_command: 'ssh' 'hostname' 'git-upload-pack '\''gitfile.git'\'''
fatal: The remote end hung up unexpectedly
SSH 到同一主机似乎没问题。主机的配置在~/.ssh/config
$ ssh -v hostname
OpenSSH_5.1p1, OpenSSL 0.9.8h 28 May 2008
debug1: Reading configuration data /home/user/.ssh/config
debug1: Applying options for sms
debug1: Connecting to gerrit.hostname.com [IP_ADDR] port PORT_NUM.
debug1: Connection established.
debug1: identity file /home/user/.ssh/id_rsa type 1
debug1: Remote protocol version 2.0, remote software version SSHD-CORE-0.4.0-R897374
debug1: no match: SSHD-CORE-0.4.0-R897374
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Host '[hostname.com]:PORT' is known and matches the RSA host key.
debug1: Found key in /home/user/.ssh/known_hosts:34
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /home/user/.ssh/id_rsa_gupshup
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
gerrit: no shell available
debug1: channel 0: free: client-session, nchannels 1
Connection to hostname.com closed.
Transferred: sent 2584, received 1888 bytes, in 1.5 seconds
Bytes per second: sent 1744.8, received 1274.8
debug1: Exit status 127
使用 GIT_SSH 变量将 SSH 更改为 C:\Program Files\Git\bin\ssh.exe 会产生相同的错误屏幕。尝试使用(Putty 的)plink 配置 Git 没有产生任何结果。我没弄好。
Git 版本为git version 1.7.4.msysgit.0
这个错误有什么解决办法吗?
【问题讨论】:
-
您似乎将 msysgit 与 cygwin 混合在一起。卸载其中之一。这不是一个编程问题。 :)
-
我在 cygwin 中没有 git。 “which git”显示位置为“/cygdrive/c/Program Files/Git/bin/git”。请让我知道此问题的正确 StackExchange 站点。
-
我建议你卸载 msysgit 并从 cygwin 安装中安装 git(运行 cygwin setup 并选择要安装的 git 包)。
-
错误是否仍然存在于您的 msysgit 和 msysgit bash 会话(与 msysgit 一起打包)而不是在 cygwin 会话中使用 msysgit?
-
将 cygwin 更新到最新版本,一切正常。感谢@sinelaw 和@VonC 的帮助。
标签: windows git windows-xp ssh