linux - 将 git 与第二次编译的 ssh 一起使用

标签 linux git ssh

我的机器运行的是 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/

相关文章:

c - 为什么长时间运行的程序总是要收割它们的僵尸 child ?

git - 管理自托管存储库和测试的分支

git pull 返回警告 : remote port forwarding failed for listen port 52698

Git 错误 : The requested URL returned error: 504 Gateway Timeout while accessing http://

git - 如何在Windows上获得更快的SSH克隆速度?

git - 如何将 Azure DevOps 存储库镜像到 gitlab 存储库

linux - 用于测试文件是否包含多个字符串的 Bash 脚本,否则添加缺少的字符串?

python - 如何对在 443 以外的不同端口上运行的应用程序使用 https

ssh - 在SSH中使用SSH服务器和vi编辑器,如何复制代码行并粘贴到记事本中

linux - 无需工具即可闪存 NodeMCU v3