2011-07-13 72 views
6

兴奋的是准备做我的第一个git push过,我在cygwin环境下创造了PuTTY别名:混帐推失败(致命:远程端挂了意外)

alias ssh="/cygdrive/c/PROGRA~2/putty/PUTTY.EXE" 

然后调用(我的工作目录中,当然),只是在第47页中git community book作为解释:

git push ssh://mylinuxserver/~winwin/gitrepo master:master 

我的兴奋并没有持续很长时间,因为这会立即致命错误失败:

error: cannot run ssh: No such file or directory 
fatal: unable to fork 

考虑,我能够成功运行,在完全相同的命令行和shell实例ssh [email protected]我很惊讶地收到此错误信息。

任何想法为什么发生这种情况,以及如何解决这个问题?

UPDATE I:感谢this guide,我发现PUTTY.EXE不是在git中使用的正确exe文件。相反,应该使用PLINK.EXE

该指南还提示应该使用名为GIT_SSH的环境变量让git知道如何去做这个魔法。所以,我:

~/sb/ws> export GIT_SSH=/cygdrive/c/PROGRA~2/putty/PLINK.EXE 
~/sb/ws> git push ssh://mylinuxserver/~winwin/gitrepo master:master 

,现在我收到一个不同的错误:

fatal: The remote end hung up unexpectedly 

我认为方向是正确的这一进展,但我仍然不知道如何解决这个问题。任何想法将非常感激。

更新II:仍试图解决这个谜。这一次,我怀疑由于git push不提示任何地方的用户名+密码,身份验证必须位于密钥...因此,我仔细检查sshd配置每this howto。我发现唯一需要更改的是取消HostKey /etc/ssh/ssh_host_dsa_key/etc/ssh/sshd_config的注释并重新启动服务service sshd restart。之后,在第一时间,$GIT_SSH没有提示确认服务器的DSS密钥指纹和我确认存储在缓存中的关键,但是......问题依然存在:

fatal: The remote end hung up unexpectedly 

更多的想法?

(PuTTY的注册表现在包含在同一台服务器的两个键:[email protected]:mylinuxserver[email protected]:mylinuxserver嗯...我不知道这是什么意思)

更多诊断信息:键入$GIT_SSH -v产量:

~/sb/ws> $GIT_SSH -v 
Looking up host "mylinuxserver" 
Connecting to 192.168.1.2 port 22 
Server version: SSH-2.0-OpenSSH_4.2 
We claim version: SSH-2.0-PuTTY_Release_0.60 
Using SSH protocol version 2 
Doing Diffie-Hellman group exchange 
Doing Diffie-Hellman key exchange with hash SHA-1 
Host key fingerprint is: 
ssh-dss 1024 c8:77:42:4f:76:29:56:4c:ea:b0:11:6a:a6:3c:6a:f7 
Initialised AES-256 SDCTR client->server encryption 
Initialised HMAC-SHA1 client->server MAC algorithm 
Initialised AES-256 SDCTR server->client encryption 
Initialised HMAC-SHA1 server->client MAC algorithm 
login as: winwin 
[email protected]'s password: 
Sent password 
Access granted 
Opened channel for session 
Allocated pty (ospeed 38400bps, ispeed 38400bps) 
Started a shell/command 
Last login: Wed Jul 13 21:41:12 2011 from winmachine 

你能发现任何可疑的东西吗?

如何到达:到目前为止,我的情况的最佳指南:Git, SSH, PuTTY

见解:

  1. $GIT_SSH -agent必须运行一次
  2. PAGEANT.EXE必须在后台运行(和私钥通过其系统托盘图标加入吧!)
  3. PUTTYGEN.EXE必须用于生成公钥/私钥对
  4. dss不是必需的,rsa就足够了。
  5. More? (除非$GIT_SSH -2 -C -i C:\\Users\\winwin\\SSH\\private.ppk成功,没有密码提示,没有点,甚至尝试git push ......)一个新的消息

复制粘贴&从PuTTY密钥生成到/home/winwin/.ssh/authorized_keys的公钥mylinuxserver后响应露面在上述的洞察力#5命令:

Server refused our key 

这是一个好兆头... :)我觉得我对我的方式解决其中的奥秘。

UPDATE III: sshd服务器上/etc/ssh/sshd_config改变StrictModes没有后,我设法与$GIT_SSH -2 -C -i C:\\Users\\winwin\\SSH\\private.ppk成功。它仍然提示输入用户名,但(但不提示输入密码)。

git push ssh://mylinuxserver/~winwin/gitrepo master:master继续。然而失败 - 有相同的错误消息:

fatal: The remote end hung up unexpectedly 

这是疯了。

UPDATE IV:参考PLINK的-l username是关键。我设法通过创建1行shell脚本/cygdrive/c/PROGRA~2/putty/PLINK.EXE -l winwin $*并将整个脚本的路径导出为$GIT_SSH,但“远程端仍意外挂断”,成功登录git push

这是我收到的客户端(在Windows /腻子)侧:

~/sb/ws> git push ssh://mylinuxserver/~winwin/gitrepo master:master 
Environment: 
    USER=winwin 
    LOGNAME=winwin 
    HOME=/home/winwin 
    PATH=/usr/local/bin:/bin:/usr/bin 
    MAIL=/var/mail/winwin 
    SHELL=/bin/bash 
    SSH_CLIENT=192.168.1.8 50951 22 
    SSH_CONNECTION=192.168.1.8 50951 192.168.14.2 22 
bash: mylinuxserver: command not found 
fatal: The remote end hung up unexpectedly 

,这就是我得到在服务器端(Linux的/ sshd的)侧:

debug1: sshd version OpenSSH_4.2p1 
debug1: read PEM private key done: type RSA 
debug1: private host key: #0 type 1 RSA 
debug1: read PEM private key done: type DSA 
debug1: private host key: #1 type 2 DSA 
debug1: rexec_argv[0]='/usr/sbin/sshd' 
debug1: rexec_argv[1]='-d' 
debug1: Bind to port 22 on ::. 
Server listening on :: port 22. 
debug1: Bind to port 22 on 0.0.0.0. 
Bind to port 22 on 0.0.0.0 failed: Address already in use. 
debug1: Server will not fork when running in debugging mode. 
debug1: rexec start in 4 out 4 newsock 4 pipe -1 sock 7 
debug1: inetd sockets after dupping: 3, 3 
Connection from 192.168.1.8 port 50951 
debug1: Client protocol version 2.0; client software version PuTTY_Release_0.60 
debug1: no match: PuTTY_Release_0.60 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_4.2 
debug1: permanently_set_uid: 74/74 
debug1: list_hostkey_types: ssh-rsa,ssh-dss 
debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug1: kex: client->server aes256-ctr hmac-sha1 none 
debug1: kex: server->client aes256-ctr hmac-sha1 none 
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST_OLD received 
debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent 
debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT 
debug1: SSH2_MSG_KEX_DH_GEX_REPLY sent 
debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS 
debug1: SSH2_MSG_NEWKEYS received 
debug1: KEX done 

debug1: userauth-request for user winwin service ssh-connection method none 
debug1: attempt 0 failures 0 
debug1: PAM: initializing for "winwin" 
debug1: PAM: setting PAM_RHOST to "win7client" 
debug1: PAM: setting PAM_TTY to "ssh" 
Failed none for winwin from 192.168.1.8 port 50951 ssh2 
debug1: userauth-request for user winwin service ssh-connection method publickey 
debug1: attempt 1 failures 1 
debug1: test whether pkalg/pkblob are acceptable 
debug1: temporarily_use_uid: 513/513 (e=0/0) 
debug1: trying public key file /home/winwin/.ssh/authorized_keys 
debug1: matching key found: file /home/winwin/.ssh/authorized_keys, line 1 
Found matching RSA key: bd:a6:4a:6a:04:43:8d:60:d9:bf:66:de:51:13:83:66 
debug1: restore_uid: 0/0 
Postponed publickey for winwin from 192.168.1.8 port 50951 ssh2 
debug1: userauth-request for user winwin service ssh-connection method publickey 
debug1: attempt 2 failures 1 
debug1: temporarily_use_uid: 513/513 (e=0/0) 
debug1: trying public key file /home/winwin/.ssh/authorized_keys 
debug1: matching key found: file /home/winwin/.ssh/authorized_keys, line 1 
Found matching RSA key: bd:a6:4a:6a:04:43:8d:60:d9:bf:66:de:51:13:83:66 
debug1: restore_uid: 0/0 
debug1: ssh_rsa_verify: signature correct 
debug1: do_pam_account: called 
Accepted publickey for winwin from 192.168.1.8 port 50951 ssh2 
debug1: monitor_child_preauth: winwin has been authenticated by privileged process 
Accepted publickey for winwin from 192.168.1.8 port 50951 ssh2 
debug1: PAM: reinitializing credentials 
debug1: permanently_set_uid: 513/513 
debug1: Entering interactive session for SSH2. 
debug1: server_init_dispatch_20 
debug1: server_input_channel_open: ctype session rchan 256 win 16384 max 16384 
debug1: input_session_request 
debug1: channel 0: new [server-session] 
debug1: session_new: init 
debug1: session_new: session 0 
debug1: session_open: channel 0 
debug1: session_open: session 0: link with channel 0 
debug1: server_input_channel_open: confirm session 
debug1: server_input_channel_req: channel 0 request exec reply 1 
debug1: session_by_channel: session 0 channel 0 
debug1: session_input_channel_req: session 0 req exec 
debug1: Received SIGCHLD. 
debug1: session_by_pid: pid 3441 
debug1: session_exit_message: session 0 channel 0 pid 3441 
debug1: session_exit_message: release channel 0 
debug1: session_close: session 0 pid 3441 
debug1: channel 0: free: server-session, nchannels 1 

Connection closed by 192.168.1.8 
debug1: do_cleanup 
debug1: PAM: cleanup 
Closing connection to 192.168.1.8 
debug1: PAM: cleanup 

最后线索需要...

  1. 是什么bash: mylinuxserver: command not found意思?
  2. 什么是git push试图运行?
  3. 哪个命令?
  4. 在客户端还是SSH服务器上?
+1

你能创建一个从PuTTY到ssh.exe的符号链接吗? –

+0

@本霍金是的我可以,但看到我的更新上面。感谢+1。 – WinWin

+0

为什么不使用“真正的”ssh,即Cygwin的openssh软件包? – ak2

回答

0

我从未成功制作gitPuTTY一起使用。我的进一步时间投资似乎没有合理的投资回报率,所以我放弃了。

2

using plink?您可能需要重新创建您为腻子创建的键。

http://www.xinotes.org/notes/note/156/

+0

是的,我正在使用PLINK.EXE。先看看我的更新。感谢+1链接。我的'HKEY_CURRENT_USER'包含正确的密钥,但'HKEY_USERS \ .DEFAULT'有** none **出于某种原因。我会尝试并报告。 – WinWin

+1

好吧,把钥匙复制到'HKEY_USERS \ .DEFAULT'上,但我仍然得到'致命的:远程端意外挂起'错误。我怀疑这是因为PLINK试图默认连接到**不同的主机**。我该如何改变它? – WinWin

+1

好的,连接到不同主机的问题[已解决](http://superuser.com/questions/310181/plink-is-stuck-at-an-older-host-how-do-i-replace - 它/ 310207#310207)。但是错误'致命的:远端意外挂断'仍然存在。我如何找到原因? – WinWin

2

感觉好像经历腻子是何等的创建所有的这些问题,但为什么这是必要的,目前还不清楚 - 如果你使用Cygwin的,那么你已经建成SSH

我用通过ssh通过cygwin git没有问题。可能是更好的路线?是否有合并腻子的理由,还是在某个指南中推荐的东西?

+0

我同意。另一方面,通过这种徒劳的练习帮助我学习了我以前从未学过的东西。 – WinWin

相关问题