在空闲命令提示符下由远程主机关闭的<git-host>连接

时间:2015-11-18 16:26:22

标签: git ssh

我可以使用git就好了,当我从遥控器推或拉时我没有收到任何错误。这就是为什么关于远程主机关闭的连接的所有其他答案都没有真正帮助。

似乎git主机(这种情况发生在我身上,无论我是连接到我公司的存储服务器还是github.com),在我拉或推之后很快就关闭了我的ssh连接。例如,我做了git pull -ff等了几秒钟,然后开始输入git checkout develop,这就是发生的事情:

git checkout deveConnection to <git-host> closed by remote host.lopConnection to <git-host> closed by remote host.

我最近对~/.ssh/config进行了一些更改,看起来像是这样:

ControlMaster auto
ControlPath ~/.ssh/control-master/%r@%h:%p
HashKnownHosts yes
ForwardAgent yes

# ControlPersist keeps connection for 10 minutes after all jump sessions
# are closed. It sets up a background session for that first one
# that will exit one second after all its children have logged out. You
# can close any window without losing your session until you've close
# them all.
ControlPersist 1440m

Host <internal git>
    IdentityFile <internal-git-ssh-key>
    StrictHostKeyChecking no

我只想停止通过git遥控器快速关闭我的连接,我该怎么做?

1 个答案:

答案 0 :(得分:0)

似乎ControlMaster和ControlPath是罪魁祸首,将那些置于主机条目下的只需要它的服务器解决了我的问题。

HashKnownHosts yes
ForwardAgent yes

# ControlPersist keeps connection for 10 minutes after all jump sessions
# are closed. It sets up a background session for that first one
# that will exit one second after all its children have logged out. You
# can close any window without losing your session until you've close
# them all.
ControlPersist 1440m

Host <internal git>
    IdentityFile <internal-git-ssh-key>
    StrictHostKeyChecking no

Host <internal hosts needing ControlMaster>
    ControlMaster auto
    ControlPath ~/.ssh/control-master/%r@%h:%p