【发布时间】:2021-10-01 03:17:42
【问题描述】:
我正在尝试设置与 bitbucket 的无密码 git 连接。我在 Windows Server 2008 上使用 git bash。
通过 HTTPS 克隆工作正常:
nskoric@P8-DEV /z/test
$ git clone https://dijxtra@bitbucket.org/nek-plan/gittest.git
Cloning into 'gittest'...
Password for 'https://dijxtra@bitbucket.org':
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
Checking connectivity... done.
但是,HTTPS 是不可接受的,因为我需要无密码登录。所以我生成了一个私钥/公钥对,将公钥上传到 bitbucket 并在 .ssh/config 中设置 Host/IdentitiyFile。然后我尝试连接,但失败了。
我公司防火墙上的 22 端口已关闭:
nskoric@P8-DEV /z/test
$ ssh git@bitbucket.org -vv
OpenSSH_6.6.1, OpenSSL 1.0.1i 6 Aug 2014
debug1: Reading configuration data /u/.ssh/config
debug1: /u/.ssh/config line 1: Applying options for *bitbucket.org
debug2: ssh_connect: needpriv 0
debug1: Connecting to bitbucket.org [131.103.20.168] port 22.
所以,根据 bitbucket 文档,我使用的是端口 443:
nskoric@P8-DEV /z/test
$ git clone ssh://git@altssh.bitbucket.org:443/nek-plan/gittest.git
Cloning into 'gittest'...
ssh_exchange_identification: read: Connection reset by peer
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我尝试使用谷歌搜索“bitbucket ssh_exchange_identification: read: Connection reset by peer”,但没有帮助:-/ 然后我尝试调试 SSH 连接,但这是我得到的最远的:
nskoric@P8-DEV /z/test
$ ssh git@altssh.bitbucket.org -p 443 -vv
OpenSSH_6.6.1, OpenSSL 1.0.1i 6 Aug 2014
debug1: Reading configuration data /u/.ssh/config
debug1: /u/.ssh/config line 1: Applying options for *bitbucket.org
debug2: ssh_connect: needpriv 0
debug1: Connecting to altssh.bitbucket.org [131.103.20.174] port 443.
debug1: Connection established.
debug1: identity file /u/.ssh/bitbucketnek type 1
debug1: identity file /u/.ssh/bitbucketnek-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
ssh_exchange_identification: read: Connection reset by peer
所以,SSH 找到了正确的身份文件 (/u/.ssh/bitbucketnek) 然后死了。现在,如果我能确定问题出在我的“bitbucketnek”私钥中,还是我们公司防火墙中的问题,或者第三个问题,那将非常有帮助。有什么想法吗?
谢谢!
【问题讨论】: