在过去几天中,我无法推送到远程(gitlab),之前是可以的。我知道这个问题有数十个类似的SO问题,并且也许答案就在其中某个问题中。但是我已经尝试了许多建议的解决方案,但都没有成功。
当我推送时,会出现以下错误: ssh: connect to host gitlab.com port 22: Connection refused fatal: The remote end hung up unexpectedly
本地计算机位于宪法服务器上,这里的许多人主要使用端口22进行github操作,没有问题。这可能是与gitlab特定相关的我的防火墙设置导致的吗?管理员确保这不是简单的白名单问题。
我的gitlab url如下: 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密钥(失败了)。
我已经尝试了很多方法,但是我的分支比origin超前了很多提交。我是否遗漏了一些简单的尝试方法?
更新: 当我删除~/.ssh/config并发出ssh -Tv git@gitlab.com时,它仍然无法工作 - 我得到以下错误:
当我推送时,会出现以下错误: ssh: connect to host gitlab.com port 22: Connection refused fatal: The remote end hung up unexpectedly
本地计算机位于宪法服务器上,这里的许多人主要使用端口22进行github操作,没有问题。这可能是与gitlab特定相关的我的防火墙设置导致的吗?管理员确保这不是简单的白名单问题。
我的gitlab url如下: 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密钥(失败了)。
我已经尝试了很多方法,但是我的分支比origin超前了很多提交。我是否遗漏了一些简单的尝试方法?
更新: 当我删除~/.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 目录。
ssh -Tv git@github.com
一起使用吗?如果不能,那么 https://about.gitlab.com/2016/02/18/gitlab-dot-com-now-supports-an-alternate-git-plus-ssh-port/ 是否有帮助?(我在 https://dev59.com/qY_ea4cB1Zd3GeqPMEeI#35500957 中提到了它) - VonC