我想使用 ssh 身份驗證克隆 bitbucket 存盤庫,因為通過 https 方法進行克隆會為我的存盤庫中的 1Gb 之一提供連接超時錯誤。
我在 Windows 客戶端上使用“ssh-keygen”生成了 ssh 密鑰,公鑰(id_rsa)被添加到我的 bitbucket 帳戶中。設定 --> 管理帳戶 ---> SSH 密鑰
Bitbucket DataCenter 托管在 Azure linux(Ubuntu) vm 上,默認 ssh 埠 7999 在我的機器 ip 的 azure 防火墻上列入白名單,并且在 linux 服務器上沒有激活內部防火墻。
我的帳戶具有系統管理員權限。
git clone 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
uj5u.com熱心網友回復:
感謝您對問題的所有投入,非常感謝。它幫助我獲得了新的資訊。但是,即使按照@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 密鑰位置:C:\Users\UserName.ssh 從檔案id_ed25519.pub 中復制密鑰內容并將此公鑰添加到您的 Bitbucket 帳戶中。設定 --> 管理帳戶 ---> SSH 密鑰
這將建立與 Bitbucket 服務器的連接,并且您的存盤庫將使用 ssh url 克隆而不會出現任何問題。
git clone <ssh_repository_url>
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/391833.html
