GitLab (SSH) 通过 public WIFI,端口 22 被阻止
GitLab (SSH) via public WIFI, port 22 blocked
我使用星巴克 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?
定义您的遥控器,使其使用端口 443
git remote add origin ssh://some.host:443/path/to/repo.git
感谢@oleg-gopkolov 给了我尝试以不同方式定义原点的提示!事实证明 ssh 端口 443 不起作用,但 https 如下所示。
如何将 origin 切换到 https,以便在星巴克 wifi 上推送到 gitlab.com 时有效
以下是切换到 https 的命令(如果您已经尝试过其他更改并且您的本地版本像我的一样已过时,您还需要遵循 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 结帐选项确实有效。因此,如果您不介意重新结帐,您可以 运行 在星巴克 wifi 上这样做:
git clone https://gitlab.com/your_username/your_repo.git
然后要测试提交,您可以编辑 README.md 然后 运行:
git commit README.md
git push
如果您想确认 SSH GitLab 访问在星巴克 wifi 上不起作用
要确认 SSH 克隆在星巴克不起作用,您可以运行以下 3 个命令之一:
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
对于每一个你都会得到这样的错误:
Cloning into 'your_repo'...
ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.
自 2016 年 2 月起,您不再需要切换到 https。
您可以在 ssh 上推送到 GitLab...端口 443(通常为 https 事务保留的端口)
参见“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
[您可能需要更改您的远程来源 url:
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.
我使用星巴克 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?
定义您的遥控器,使其使用端口 443
git remote add origin ssh://some.host:443/path/to/repo.git
感谢@oleg-gopkolov 给了我尝试以不同方式定义原点的提示!事实证明 ssh 端口 443 不起作用,但 https 如下所示。
如何将 origin 切换到 https,以便在星巴克 wifi 上推送到 gitlab.com 时有效
以下是切换到 https 的命令(如果您已经尝试过其他更改并且您的本地版本像我的一样已过时,您还需要遵循 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 结帐选项确实有效。因此,如果您不介意重新结帐,您可以 运行 在星巴克 wifi 上这样做:
git clone https://gitlab.com/your_username/your_repo.git
然后要测试提交,您可以编辑 README.md 然后 运行:
git commit README.md
git push
如果您想确认 SSH GitLab 访问在星巴克 wifi 上不起作用
要确认 SSH 克隆在星巴克不起作用,您可以运行以下 3 个命令之一:
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
对于每一个你都会得到这样的错误:
Cloning into 'your_repo'...
ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.
自 2016 年 2 月起,您不再需要切换到 https。
您可以在 ssh 上推送到 GitLab...端口 443(通常为 https 事务保留的端口)
参见“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
[您可能需要更改您的远程来源 url:
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.