通过公共WIFI的GitLab(SSH),端口22被阻止 [英] GitLab (SSH) via public WIFI, port 22 blocked

查看:673
本文介绍了通过公共WIFI的GitLab(SSH),端口22被阻止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用星巴克wifi,尝试推送到gitlab.com存储库时得到以下信息:

I using Starbucks wifi and I get the following when trying to push to a gitlab.com repo:

  $ 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,通过将以下内容添加到〜/.ssh/config

I tried adapting a workaround for GitHub: Github (SSH) via public WIFI, port 22 blocked by adding the following to ~/.ssh/config

 Host gitlab.com
        Hostname gitlab.com
        Port 443

但是当我收到此错误时,该方法不起作用:

But that doesn't work as I get this error:

 $ 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吗?

I there a workaround that will allow me to push to GitLab.com using port 443?

推荐答案

感谢@ oleg-gopkolov给我的提示,试图以不同的方式定义起源!事实证明,ssh端口443无法正常工作,但https却如下所示.

Thanks to @oleg-gopkolov for giving me the hint to try defining the origin differently! It turns out ssh port 443 didn't work but https did as per below.

以下是切换到https的命令(如果您尝试了其他更改,并且您的本地设备像我一样过时了,那么您还需要遵循

Here are the commands to switch to https (if you had experimented with other changes and your local is out of date like mine was you will also need to follow Cannot push to GitHub - keeps saying need merge ):

git remote remove origin
git remote add origin https://gitlab.com/your_username/your_repo.git
git push --set-upstream origin master

如果您想对新的结帐进行一些测试

事实证明,使用https checkout选项确实有效.因此,只要您不介意重新结帐,就可以在星巴克wifi上运行它:

If you want to do some testing on a fresh checkout

It turns out that using the https checkout option does work. So provided you don't mind a fresh checkout, you can run this on Starbucks wifi:

git clone https://gitlab.com/your_username/your_repo.git

然后要测试提交,可以编辑README.md,然后运行:

Then to test committing you can edit README.md and then run:

  git commit README.md
  git push

如果您想确认SSH GitLab访问在星巴克wifi上不起作用

要确认在星巴克上SSH克隆不起作用,您可以运行以下3个命令之一:

If you want to confirm that SSH GitLab access doesn't work on Starbucks wifi

To confirm that SSH cloning does not work at Starbucks you can run one of the following 3 commands:

git clone git@gitlab.com:your_username/your_repo.git
git clone git@gitlab.com:443/your_username/your_repo.git
git clone ssh://gitlab.com:443your_username/your_repo.git

对于每个人,您都会得到如下错误:

And for each one you will get an error like this:

Cloning into 'your_repo'...
ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.

这篇关于通过公共WIFI的GitLab(SSH),端口22被阻止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆