在EC2实例上运行ubuntu。我想用github服务器设置Jenkins SSH,但是当我运行命令时

ssh -vT git@github.com

我收到以下输出:
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to github.com [192.30.253.113] port 22.
ssh: connect to host github.com port 22: Connection timed out

jenkins的ssh密钥位于/var/lib/jenkins/.ssh文件夹中,但看起来ssh配置数据正在/etc/文件夹中读取
我已经将公共SSH密钥添加到我的github帐户中,并已验证我是以一行的形式添加的。
我还缺什么?
我偶然发现这个Creating SSH keys for Gerrit and Hudson可能是它没有联系的一个潜在原因,但我发现,对某人来说,这最后一次发生在5年前是极不可能的。

最佳答案

当您收到Connection timed out错误时,这看起来更像是一个网络问题。
因此,首先检查您是否真的可以连接到github服务器,例如使用nmaptelnet;如果网络正常,输出应该如下所示:

$ telnet github.com 22
Trying 192.30.253.112...
Connected to github.com.
Escape character is '^]'.
SSH-2.0-libssh-0.7.0

ssh键通常位于$HOME/.ssh/(其中$HOME是运行Jenkins master的用户的主目录)文件夹/var/lib/jenkins/.ssh看起来至少不正常。
目录/etc/ssh包含系统范围的ssh配置数据,它将始终被读取,不用于用户特定的配置项。

09-04 02:52
查看更多