ssh - GitLab (SSH) 通过公共(public) WIFI,端口 22 被阻止

标签 ssh wifi gitlab

我使用星巴克 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) via public WIFI, port 22 blocked将以下内容添加到 ~/.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。
您可以在端口 443(通常为 https 事务保留的端口)上通过 ssh 推送到 GitLab

参见“GitLab.com now supports an alternate git+ssh port

GitLab.com 运行第二个 SSH 服务器,该服务器监听常用端口 443,该端口不太可能受到防火墙保护。

All you have to do is edit your ~/.ssh/config and change the way you connect to GitLab.com.
The two notable changes are Hostname and Port:

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

]

The first time you push to altssh.gitlab.com you will be asked to verify the server’s key fingerprint:

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)?

That’s only normal since you are connecting to the new loadbalancer. If you watch closely, the key fingerprint is the same as in GitLab.com.

关于ssh - GitLab (SSH) 通过公共(public) WIFI,端口 22 被阻止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32669420/

相关文章:

jenkins 当 gitlab 发生更改时如何触发构建

ruby-on-rails - rails 测试在 gitlab 管道中不起作用

gitlab - 如何在 GitLab 中添加 "about us"页面?

hadoop - Hadoop:无密码SSH错误

Vim:通过 tmux + ssh 添加 cursorshape 支持

android - 如何在Android Studios中获取附近的Wifi距离和方向

android - 我正在使用 wpa_supplicant。尝试连接 WEP 保护的 AP 时如何知道密码错误?

ssh - 有没有一种简单的方法可以在同一个 gitolite 客户端上使用多个私有(private) ssh key ?

git : "git-upload-pack: command not found" while pushing to remote server

java - 当我的应用程序被杀死时有机会做某事