mux_client_request_session:会话请求失败:会话打开被同级拒绝

时间:2018-09-25 10:29:47

标签: git ssh bitbucket ssh-config

我使用bitbucket托管一些git存储库。

当我尝试做时:

git pull && git push

我得到:

mux_client_request_session: session request failed: Session open refused by peer
ControlSocket /home/ravi/.ssh/sockets/socket-git@bitbucket.org:22 already exists, disabling multiplexing

2 个答案:

答案 0 :(得分:3)

bitbucket.org has intentionally disabled ssh multiplexing,因此请编辑您的~.ssh/config文件,以便ssh在连接时不会尝试多路传输。

如果您在配置的顶层拥有ControlMaster,请确保将其删除,因为它会取代任何Host部分的配置。

然后添加:

Host bitbucket.???  # .org and .com
  ControlMaster no

Host *
  ControlMaster auto
  ControlPersist yes
  ControlPath ~/.ssh/socket-%r@%h:%p

请注意,Host bitbucket.org必须位于Host *之前。

此外,ControlPath应该只能自己写。

然后,如果错误消息中命名的ControlSocket仍然存在,请将其删除。 (它将根据ControlPersist中的超时自动删除。

答案 1 :(得分:1)

另一种方法是在本地存储库配置中更改git ssh命令并禁用多路复用模式。

git config --local core.sshCommand "ssh -o ControlPath=none"