所以我有一个个人Bitbuket帐户,我用来克隆/推/拉而没有问题
我正在使用Git-Bash并使用git config --global user.name
和git config --global user.email
和id_rsa_gitlab
做了全局用户名和密码
现在我在Gitlab上使用不同的电子邮件和密码获得了一个新帐户,我创建了一个新的SSH-Key ssh-add ~/.ssh/id_rsa_gitlab
并添加了SSH密钥Host bitbucket.org
IdentityFile ~/.ssh/id_rsa
Host gitlab
HostName gitlab.lan
User git
IdentityFile ~/.ssh/id_rsa_gitlab
和gitlab.lan帐户,并添加了该规则到配置文件...
ssh: connect to host gitlab.lan port 22: Connection timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
但是现在当我尝试从Gitlab repo克隆时,我收到了这个错误......
{{1}}
我在这里失踪了什么?
我是否需要更改全局user.name和user.password或什么?
答案 0 :(得分:0)
您需要仔细检查您的网址是否确实会影响您的~/.ssh/config
条目。
如果应该:
gitlab:project/repo.git
并且ssh -T gitlab
应该打印欢迎信息。
添加了SSH密钥
ssh-add ~/.ssh/id_rsa_gitlab
和gitlab.com
帐户
为此,请确保gitlab.com
文件中的主机名为gitlab.lan
,而不是config
。
并确保已将 public 密钥内容(~/.ssh/id_rsa_gitlab.pub
)添加到您的gitlab.com用户ssh设置。
我确认,在公司中,使用ssh的传出查询通常会被阻止!在这种情况下,使用https是一个更好的选择。