【发布时间】:2018-09-17 12:38:42
【问题描述】:
在过去的几天里,我一直无法推送到远程(gitlab),在此之前它已经工作了。我知道这个问题有 10 个类似的 SO 问题,也许答案就在其中。但是我一直在尝试许多建议的解决方案 - 徒劳无功。
-
当我推动时,我得到:
ssh: connect to host gitlab.com port 22: Connection refused fatal: The remote end hung up unexpectedly 本地服务器在宪法服务器上,这里的许多人使用 22 端口,主要用于 github,没有任何问题。这是否可能是我这边的防火墙设置,可能与 gitlab 相关?管理员确保这不是一个简单的白名单问题。
-
我的 gitlab 网址为:
origin git@gitlab.com:myname/myproject.git (fetch) origin git@gitlab.com:myname/myproject.git (push) -
我已尝试使用替代 ssh 格式更新 git-url:
origin ssh://git@gitlab.com/myname/myproject.git (fetch) origin ssh://git@gitlab.com/myname/myproject.git (push) -
我已经尝试了端口 22 和替代端口 443 - 这是
~/.ssh/config文件:Host gitlab.com RSAAuthentication yes IdentityFile ~/.ssh/id_rsa -
替代方案:
Host gitlab.com Hostname altssh.gitlab.com User git Port 443 PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa 我曾尝试使用 https 连接(徒劳无功)。
制作了新的 ssh 密钥(徒劳)。
我对尝试的事情感到迷茫,并且我的分支在很多提交之前都领先于原点。 我在这里错过了一些简单的尝试吗?。
更新
当删除 ~/.ssh/config 并发出 ssh -Tv git@gitlab.com 它仍然不起作用 - 我明白了:
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to gitlab.com [52.167.219.168] port 22.
debug1: connect to address 52.167.219.168 port 22: Connection refused
ssh: connect to host gitlab.com port 22: Connection refused
更新 2 所以事实证明,我们的机构服务器没有将 gitlab.com 列入白名单,因为它们 - 与 github.com 相比,没有提供官方 IP 地址范围。我的解决方案是从我的工作站计算机到包含我的项目的服务器建立一个挂载点,然后通过计算机推/拉 git 目录。
【问题讨论】:
标签: git ssh connection gitlab