首页 > 解决方案 > 错误:克隆项目表单 bitbucket 时“连接已关闭...”

问题描述

我最近在连接到 bitbucket 时遇到问题。例如,当我想连接到 GitHub 时没有问题。但是,当我想克隆项目时,出现此错误:

Connection closed by 18.205.93.1 port 22
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我 100% 确定我有访问权限并且存储库存在。我创建了许多不同的密钥并将其放入我的 bitbucket 中,但它并没有改变任何东西。我运行它ssh -v git@bitbucket.org以获得更多信息。这就是我所看到的:

OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
debug1: Connecting to bitbucket.org [18.205.93.2] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\nipek/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
...
debug1: Authenticating to bitbucket.org:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
...
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:zzXQOX...
debug1: Host 'bitbucket.org' is known and matches the RSA host key.
debug1: Found key in C:\\Users\\nipek/.ssh/known_hosts:3
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:M7dEqyz... C:\\Users\\nipek/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([18.205.93.2]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: console supports the ansi parsing
PTY allocation request failed on channel 0
logged in as LukNie.

You can use git or hg to connect to Bitbucket. Shell access is disabled.
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
Connection to bitbucket.org closed.
Transferred: sent 2732, received 1852 bytes, in 0.3 seconds
Bytes per second: sent 9222.4, received 6251.8
debug1: Exit status 0

最近我的系统出现问题,我丢失了一些文件,因为我的系统的一部分“恢复到初始设置”。我想知道文件之间是否存在一些错误配置,这就是原因,但是我不知道如何修复它。

标签: gitsshbitbucket

解决方案


我找到了一种解决方法。这不是一个完美的解决方案,但至少它有效。这是“如果端口 22 被阻止”下的解释https://confluence.atlassian.com/bitbucket/troubleshoot-ssh-issues-271943403.html 。一般来说,如果 22 端口有问题,可以像这样使用 443 端口:

git clone ssh://git@altssh.bitbucket.org:443/<account_name>/<repo_name>/

推荐阅读