在 gitlab 上通过端口 443 ssh 不起作用

gal*_*eej 3 gitlab

我正在尝试使用端口 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
Run Code Online (Sandbox Code Playgroud)

我不断收到以下错误:

权限被拒绝(公钥)致命:无法从远程存储库读取

错误可能是由于 ssh 密钥以外的其他原因造成的吗?

问候, Galeej

Abd*_*fai 6

我刚刚配置了它,它对我来说运行良好。

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

Host gitlab.com
  Hostname altssh.gitlab.com
  User git
  Port 443
  PreferredAuthentications publickey
  IdentityFile ~/.ssh/id_rsa
Run Code Online (Sandbox Code Playgroud)

您可以使用此命令测试连接ssh -T -p 443 git@altssh.gitlab.com

确保您已id_rsa.pub按照此处所述将公钥添加到您的 GitLab 帐户。