簡體   English   中英

git 克隆使用 ssh 連接失敗“連接重置由<server_ip>端口 7999"</server_ip>

[英]git clone using ssh connection fails "Connection reset by <server_IP> port 7999"

我想使用 ssh 身份驗證克隆 bitbucket 存儲庫,因為通過 https 方法進行克隆時,我的存儲庫中的一個存儲庫是 1Gb+ 時出現連接超時錯誤。

我在 windows 客戶端上使用“ssh-keygen”生成了 ssh 密鑰,公鑰(id_rsa)已添加到我的 bitbucket 帳戶中。 設置 --> 管理帳戶 ---> SSH 密鑰

Bitbucket DataCenter is hosted on Azure linux(Ubuntu) vm, default ssh port 7999 is whitelisted on azure firewall for my machine ip and there is no internal firewall activated on linux server.

我的帳戶具有系統管理員權限。

git 克隆 ssh://git@serverURL:7999/dem/projectname.git

錯誤信息:

Cloning into 'projectname'...
kex_exchange_identification: read: Connection reset by peer
Connection reset by Server_ip port 7999
fatal: Could not read from remote repository.

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

我還嘗試在 bitbucket 服務器上的 /etc/hosts.allow 中添加“sshd:mySystem_IP”,但仍然出現相同的錯誤。

有沒有人遇到過類似的問題? 不確定我在這里的配置中缺少什么。 感謝您的時間!

使用 ssh -vT 進行調試:

ssh -vT ssh://git@bitbucket_url.com:7999
OpenSSH_8.8p1, OpenSSL 1.1.1l 24 Aug 2021
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to Server_IP port 7999.
debug1: Connection established.
debug1: identity file /c/Users/user_name/.ssh/id_rsa type 0
debug1: identity file /c/Users/user_name/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/user_name/.ssh/id_dsa type -1
debug1: identity file /c/Users/user_name/.ssh/id_dsa-cert type -1
debug1: identity file /c/Users/user_name/.ssh/id_ecdsa type -1
debug1: identity file /c/Users/user_name/.ssh/id_ecdsa-cert type -1
debug1: identity file /c/Users/user_name/.ssh/id_ecdsa_sk type -1
debug1: identity file /c/Users/user_name/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /c/Users/user_name/.ssh/id_ed25519 type 3
debug1: identity file /c/Users/user_name/.ssh/id_ed25519-cert type -1
debug1: identity file /c/Users/user_name/.ssh/id_ed25519_sk type -1
debug1: identity file /c/Users/user_name/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /c/Users/user_name/.ssh/id_xmss type -1
debug1: identity file /c/Users/user_name/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.8
kex_exchange_identification: read: Connection reset by peer
Connection reset by Server_IP port 7999

感謝您對問題的所有投入,非常感謝。 它幫助我獲得了新的信息。 但是,即使按照@torek 的建議將 OpenSSH 更新到最新版本,我也面臨同樣的問題。 最后,我嘗試使用與默認 RSA 不同的加密算法。

ssh-keygen uses RSA by default for generation of access keys.
ssh-keygen -t ed25519 -C "Comment"  uses elliptic curve cryptography

ssh-keygen -t ed25519 為我工作

SSH Key location: C:\Users\UserName.ssh Copy the key contents from file id_ed25519.pub and add this public key into your Bitbucket account. 設置 --> 管理帳戶 ---> SSH 密鑰

這將建立與 Bitbucket 服務器的連接,並且您的存儲庫將使用 ssh url 克隆而不會出現任何問題。

git clone <ssh_repository_url>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM