Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Unidentified errors with git clone

Samveen Gulati _via Sygitech_
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 11, 2024

I'm trying to clone a BB-cloud git repository via SSH, but I am failing to do this. The details are as follows:

- ed25519 SSH key added to my BB cloud profile.

- 2FA enabled

- I have admin access to the repo via group membership at multiple levels:

Screenshot_2024-06-11_23-57-20.png

- I have added my user to the repo permissions with `write` access.

Screenshot_2024-06-11_23-58-42.png

- git clone using the SSH clone URL after setting GIT_SSH_COMMAND="ssh -v"  shows that my key is accepted by the server. However the clone fails as below (with redacted content):

debug1: Offering public key: samveen@xxxcom ED25519 SHA256:7CLdQX21NHBoLKkXcaL08HIyw6tnX+479ZHpmY3b7rk agent
debug1: Server accepts key: samveen@xxxcom ED25519 SHA256:7CLdQX21NHBoLKkXcaL08HIyw6tnX+479ZHpmY3b7rk agent
Authenticated to bitbucket.org ([104.192.141.1]:22) using "publickey".
debug1: channel 0: new session [client-session] (inactive timeout: 0)
debug1: Entering interactive session
debug1: pledge: filesystem
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: client_input_hostkeys: searching /home/samveen/.ssh/known_hosts for bitbucket.org / (none)
debug1: client_input_hostkeys: searching /home/samveen/.ssh/known_hosts2 for bitbucket.org / (none)
debug1: client_input_hostkeys: hostkeys file /home/samveen/.ssh/known_hosts2 does not exist
debug1: client_input_hostkeys: no new or deprecated keys from server
debug1: Requesting authentication agent forwarding.
debug1: Sending environment.
debug1: channel 0: setting env GIT_PROTOCOL = "version=2"
debug1: channel 0: setting env LANG = "en_US.UTF-8"
debug1: Sending command: git-upload-pack 'xxx/yyy.git'
debug1: pledge: agent
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
The requested repository either does not exist or you do not have access. If you believe this repository exists and you have access, make sure you're authenticated.
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2356, received 2216 bytes, in 0.5 seconds
Bytes per second: sent 4804.1, received 4518.7
debug1: Exit status 1
fatal: Could not read from remote repository.

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

- git version: `2.39.2`

Where am I going wrong?

 

1 answer

1 accepted

1 vote
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 13, 2024

Hello @Samveen Gulati _via Sygitech_ ,

and welcome to the Community!

Based on the logs you've shared, it seems that git is using the SSH keys that were added to the ssh-agent :

debug1: Offering public key: samveen@xxxcom ED25519 SHA256:7CLdQX21NHBoLKkXcaL08HIyw6tnX+479ZHpmY3b7rk agent
debug1: Server accepts key: samveen@xxxcom ED25519 SHA256:7CLdQX21NHBoLKkXcaL08HIyw6tnX+479ZHpmY3b7rk agent

When the authentication passes, it means Bitbucket recognizes that key, but it doesn't necessarily mean that key has authorization to access a given resource. This depends on where the key is added (to the user profile or as an access key in the repo/project/workspace).

That being said, by any chance you have multiple keys currently added to your ssh-agent ? I ask this because the agent might be trying a different key other than the one you actually added to your profile.

To confirm if that is the case I would suggest the following steps:

  1.  list the currently added keys :
    ssh-add -l 
  2. Delete all the keys currently in the agent :
    ssh-add -d <path to the key>
  3. Add only the private SSH key which is the pair of the public key you put in your Bitbucket profile:
    ssh-add <path to the private key> 

Could you try the steps above and let us know how it goes?

Thank you, @Samveen Gulati _via Sygitech_ !

Patrik S 

Samveen Gulati _via Sygitech_
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 14, 2024

@Patrik Sthank you for pointing me in the correct direction.

I have 2 sshs key, the first of which had been added to another project as a deployment key, and the second of which is the key under discussion. As my agent  presents the deployment key first, I am seeing the above error, and BB cloud behaviour seems to be exactly as expected unfortunately.

I've requested the administrator of the project with the aforementioned deployment key to remove it from there, as I am no longer associated with that project, which solved the issue.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events