通过443端口在GitLab上进行SSH不起作用

3
我正在尝试使用端口443推送和拉取我的GitLab存储库,因为我的端口22已被阻止(参考:https://about.gitlab.com/2016/02/18/gitlab-dot-com-now-supports-an-alternate-git-plus-ssh-port/)。
下面是我创建的配置文件(我创建了一个新的ssh密钥,并在我的gitlab个人资料中更新了它 - 注意:我没有将服务器密钥添加为部署密钥,而是只将其添加到了我的个人资料中)。
Host gitlab.com
        Hostname altssh.gitlab.com
        User gitlabusername
        Port 443
        PreferredAuthentications publickey
        IdentityFile ~/.ssh/id_rsa.pub

我一直遇到以下错误:
权限被拒绝(publickey) 致命错误:无法从远程存储库读取
除了 ssh 密钥之外,这个错误可能是因为其他原因吗?
问候, Galeej

你有解决方案吗?我也遇到了同样的问题。 - godzsa
不,我们目前正在使用https而不是ssh。我们还没有弄清楚原因 :( - galeej
我发现在有线连接下ssh可以正常工作,但是在wifi连接下无法使用。 - godzsa
我们尝试了两种方法,但都没有帮助。 - galeej
1个回答

8

我刚刚配置好了,现在它可以正常工作。

在你的配置文件中,你需要使用私钥id_rsa进行身份验证,而不是公钥id_rsa.pub

Host gitlab.com
  Hostname altssh.gitlab.com
  User git
  Port 443
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/id_rsa

你可以使用以下命令测试连接:ssh -T -p 443 git@altssh.gitlab.com
请确保你已经按照这里的说明将公钥id_rsa.pub添加到你的GitLab账户。

1
谢谢你的回答! - galeej
如果您在Amazon EC2上运行时遇到任何权限问题,您可能需要执行chmod 600 config - Timothy Mugayi

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接