I want to clone bitbucket repository using ssh authentication as cloning through https method gives connection timed out error for one of my repository which is 1Gb in storage.
I generated ssh keys using "ssh-keygen" on windows client, public key (id_rsa) is added to my bitbucket account. Settings -->Manage Account ---> SSH keys
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.
My account is having system admin rights.
git clone ssh://git@serverURL:7999/dem/projectname.git
Error Message:
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.
Also I tried adding "sshd: mySystem_IP" in /etc/hosts.allow on bitbucket server still getting the same error.
Has anyone faced similar kind of issue? Not sure what am I missing in the configuration here. Thank you for your time!
Debug using 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
CodePudding user response:
Thanks for all your inputs for the question, really appreciated. It helped me gain new information. However even after updating OpenSSH to latest version as suggested by @torek I was facing the same issue. Finally I tried using a different encryption algorithm than default 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 worked for me
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. Settings -->Manage Account ---> SSH keys
This will establish the connection with Bitbucket server and your repository will be cloned without any issue using ssh url.
git clone <ssh_repository_url>