我的机器运行的是 CentOS 5,我无法升级它。
# ssh -V
OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
# which ssh
/usr/bin/ssh
OpenSSH/OpenSSL 太旧,无法连接到 ssh://<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9afdf3eedafbf6eee9e9f2b4f8f3eef8eff9f1ffeeb4f5e8fd" rel="noreferrer noopener nofollow">[email protected]</a>:443
(是的,有一个代理)
所以我在/tmp/ssh中编译了最新版本的ssh和ssl
# /tmp/ssh/bin/ssh -V
OpenSSH_6.9p1, OpenSSL 1.0.2j 26 Sep 2016
它就像魅力
# /tmp/ssh/bin/ssh -v <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b8dfd1ccf8d9d4cccbcbd096dad1ccdacddbd3ddcc96d7cadf" rel="noreferrer noopener nofollow">[email protected]</a> -p 443
...
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /root/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: Authentication succeeded (publickey).
Authenticated to altssh.bitbucket.org (via proxy).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
PTY allocation request failed on channel 0
logged in as *********.
You can use git or hg to connect to Bitbucket. Shell access is disabled.
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
Connection to altssh.bitbucket.org closed.
Transferred: sent 3552, received 1744 bytes, in 0.4 seconds
Bytes per second: sent 9724.6, received 4774.7
debug1: Exit status 0
现在,我如何告诉 git 使用/tmp/ssh/bin/ssh 而不是/usr/bin/ssh ?
最佳答案
您可以将替代 ssh
二进制文件的基目录添加到 PATH
前面,或者将 GIT_SSH
环境变量设置为替代ssh
。例如:
export GIT_SSH=/to/ssh/bin/ssh
关于linux - 将 git 与第二次编译的 ssh 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40426370/