我使用星巴克 wifi,在尝试推送到 gitlab.com 存储库时收到以下信息:
$ git push origin master
ssh: connect to host gitlab.com port 22: Connection refused
fatal: Could not read from remote repository.
我尝试为 GitHub 调整一个解决方法:Github (SSH) 通过公共 WIFI,端口 22 被阻止将以下内容添加到 ~/.ssh/config
Host gitlab.com
Hostname gitlab.com
Port 443
但这不起作用,因为我收到此错误:
$ git push origin master
ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我有一个解决方法可以让我使用端口 443 推送到 GitLab.com 吗?
自 2016 年 2 月起,您不再需要切换到 https。
您可以通过 ssh 在端口 443 上推送到 GitLab(该端口通常为 https 事务保留)
See "GitLab.com 现在支持备用 git+ssh 端口"
GitLab.com 运行第二个 SSH 服务器,该服务器侦听常用端口 443,该端口不太可能受到防火墙保护。
您所要做的就是编辑您的~/.ssh/config
并更改您连接到 GitLab.com 的方式。
两个显着的变化是主机名和端口:
Host gitlab.com
Hostname altssh.gitlab.com
User git
Port 443
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitlab
[您可能需要更改远程源网址:
git remote set-url origin altssh.gitlab.com:user/myrepo.git
]
第一次你推到altssh.gitlab.com
系统会要求您验证服务器的密钥指纹:
The authenticity of host '[altssh.gitlab.com]:443 ([104.208.154.249]:443)' can't be established.
ECDSA key fingerprint is SHA256:HbW3g8zUjNSksFbqTiUWPWg2Bq1x8xdGUrliXFzSnUw.
Are you sure you want to continue connecting (yes/no)?
这很正常,因为您正在连接到新的负载均衡器。如果你仔细观察的话,密钥指纹与 GitLab.com 中的相同.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)