我无法通过家用电脑获得SSH为GitLab工作。
要明确: 1. SSH在同一台机器上适用于BitBucket 2.已添加SSH密钥并且该密钥正确无误 3.我通过VPN(工作)连接
当我尝试连接-v -v -v参数时,我得到以下输出:
$ ssh git@[server] -v -v -v
OpenSSH_6.6.1, OpenSSL 1.0.1i 6 Aug 2014
debug1: Reading configuration data /c/Users/[me]/.ssh/config
debug2: ssh_connect: needpriv 0
debug1: Connecting to [server] [ip] port 22.
debug1: connect to address [server] port 22: Attempt to connect timed ` out wssh: connect to host [server] port 22: Bad file number
这可能是服务器配置问题吗?
编辑:
我生成了一个新密钥并配置了ssh来使用它。 这是输出:
$ ssh -Tvv git@[server]
OpenSSH_6.6.1, OpenSSL 1.0.1i 6 Aug 2014
debug1: Reading configuration data /c/Users/[me].ssh/config
debug1: /c/Users/[me]/.ssh/config line 5: Applying options for [server]
debug2: ssh_connect: needpriv 0
debug1: Connecting to [server] [IP] port 22.
debug1: connect to address [IP] port 22: Attempt to connect timed out without establishing a connection
ssh: connect to host [server] port 22: Bad file number
答案 0 :(得分:1)
SSH在同一台机器上适用于BitBucket SSH密钥已添加且正确
我希望它不是相同的 ssh密钥,它已被添加到GitLab,但是不同的公共密钥(对于相应的不同的私有 ssh密钥)
在这种情况下,你需要一个〜/ .sssh / config引用两个公钥,如" How to set up two SSH keys for two GitLab accounts and push/pull by using TortoiseGit?":
# my primary account for BitBucket
Host bitbucket
User git
HostName bitbucket.com
PreferredAuthentications publickey
IdentityFile C:/Users/{username}/.ssh/id_rsa1
# for GitLab server
Host gserver
User git
HostName {server}
PreferredAuthentications publickey
IdentityFile C:/Users/{username}/.ssh/id_rsa2
在此期间,检查输出:
ssh -Tvv gserver
(&{39; gserver
'是.ssh/config
文件的条目,该文件引用了正确的私有ssh密钥,而用户是' git
&#39)