短的
为什么现在git pull/push
不工作,ssh
防火墙后面正在运行(尤其是ssh git@bitbucket.org
)。
有人问过类似的问题,我已经阅读了它们。但我仍然缺乏理解。
我坐在公司防火墙后面,我设法通过配置~/.ssh/config
(使用开瓶器 + 公司 http 代理)设置到我的路由器(DD-Wrt @ Asus RT-N16,sshserver 是 dropbear)的 ssh 连接(端口 443)。
由于端口 22 被阻塞,我想我可以设置一个 ssh 隧道,这使我能够使用端口 22 来从我的工作机执行进一步的 ssh 命令,特别是与git push/pull
(使用不支持通过端口 443 进行 ssh 访问的 bitbucket 一起使用)。 ..)
我很乐意提供一些意见。或者甚至可能是其他方法。
我只是注意到...git 使用它自己的 ssh 命令(in $GIT_SSH
),我没有考虑过。但这只是问题的一小部分,因为即使ssh git@bitbucket.org
没有工作。
设想
工作机-->防火墙--> asus_rtn16 --> git repo
编辑
转发现在正在工作,我可以 ssh 进入每台机器。Git仍然有一些麻烦。
~/.ssh/config
Host asus
HostName myrouter.com
User admin
Port 443
ProxyCommand C:/cygwin/bin/corkscrew.exe companyproxy proxy_port %h %p
IdentityFile C:/cygwin/home/*user*/.ssh/id_rsa
Host *
ProxyCommand ssh asus nc -w1 %h %p
IdentityFile C:/cygwin/home/*user*/.ssh/id_rsa
我没有被提示登录。我添加了 RSA 身份验证,但也没有提示我输入保护密钥的密码。
我确实设置GIT_SSH
了指向正确的 ssh,并且配置中的路径是绝对的。
当我尝试推动时会发生这种情况
$ git push --verbose -u origin --all
Pushing to ssh://git@bitbucket.org/*username*/myrepo.git
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Reading configuration data /c/cygwin/home/*user*/.ssh/config
debug1: Applying options for asus
debug1: Applying options for *
debug1: Executing proxy command: exec C:/cygwin/bin/corkscrew.exe *proxy* *port* *router* 443
debug1: permanently_drop_suid: 500
debug1: identity file /c/cygwin/home/<user>/.ssh/id_rsa type 1
debug1: identity file /c/cygwin/home/<user>/.ssh/id_rsa type 1
debug1: Remote protocol version 2.0, remote software version dropbear_0.52
debug1: no match: dropbear_0.52
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.6
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 '[*router*]:443' is known and matches the RSA host key.
debug1: Found key in /c/cygwin/home/*user*/.ssh/known_hosts:2
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
DD-WRT v24-sp2 big (c) 2011 NewMedia-NET GmbH
Release: 02/17/11 (SVN revision: 16214)
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /c/cygwin/home/*user*/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown> # freezes here...
fatal: Could not read from remote repository. # continues after ctrl + c
Please make sure you have the correct access rights
and the repository exists.
正常的 ssh 连接应该继续
Enter passphrase for key '/home/*user*/.ssh/id_rsa':
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
Authenticated to *router* (via proxy).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending command: nc -w1 sdf-eu.org 22
调试 LV3
git push -u origin --all
失败了
debug1: Next authentication method: publickey
debug1: Offering public key: C:/cygwin/home/*user*/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug2: input_userauth_pk_ok: fp 31:cc:3b:fa:xx:xx:xx:a1:ae:d6:21:97:62:68:fa:f0
debug3: sign_and_send_pubkey
debug1: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
ssh -vvv asus
正在成功
debug1: Next authentication method: publickey
debug1: Offering RSA public key: C:/cygwin/home/*user*/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug2: input_userauth_pk_ok: fp 31:cc:3b:fa:xx:xx:xx:a1:ae:d6:21:97:62:68:fa:f0
debug3: sign_and_send_pubkey: RSA 31:cc:3b:fa:xx:xx:xx:a1:ae:d6:21:97:62:68:fa:f0
debug1: Authentication succeeded (publickey).
Authenticated to *router* (via proxy).
好像有什么问题debug3: sign_and_send_pubkey
。
附加数据
chmod of~/
是 755,chmod ofid_rsa.pub
是 644 并且id_rsa
有 600