Can't clone repo as an Admin
Asked by Adam Lucia:

Getting this error during basic SSH clone command:

\`\`\`

Cloning into '\[repo name\]'...

Forbidden

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

\`\`\`

An SSH key is added to the user account (not the repo), the account is an Admin.

Here is a detailed output:

\`\`\`

(...)

debug1: Authentication succeeded (publickey).

Authenticated to bitbucket.org (\[server ip address\]:22).

debug2: fd 6 setting O_NONBLOCK

debug2: fd 7 setting O_NONBLOCK

debug1: channel 0: new \[client-session\]

debug3: ssh_session2_open: channel_new: 0

debug2: channel 0: send open

debug3: send packet: type 90

debug1: Entering interactive session.

debug1: pledge: network

debug3: receive packet: type 91

debug2: channel_input_open_confirmation: channel 0: callback start

debug2: fd 5 setting TCP_NODELAY

debug3: ssh_packet_set_tos: set IP_TOS 0x20

debug2: client_session2_setup: id 0

debug1: Sending environment.

debug3: Ignored env NVM_INC

debug3: Ignored env SSH_AGENT_PID

debug3: Ignored env TERM_PROGRAM

debug3: Ignored env NVM_CD_FLAGS

debug3: Ignored env ANDROID_HOME

debug3: Ignored env TERM

debug3: Ignored env SHELL

debug3: Ignored env TMPDIR

debug3: Ignored env TERM_PROGRAM_VERSION

debug3: Ignored env GVM_ROOT

debug3: Ignored env TERM_SESSION_ID

debug3: Ignored env ZSH

debug3: Ignored env USER

debug3: Ignored env NVM_DIR

debug3: Ignored env SSH_AUTH_SOCK

debug3: Ignored env __CF_USER_TEXT_ENCODING

debug3: Ignored env PAGER

debug3: Ignored env LSCOLORS

debug3: Ignored env PATH

debug3: Ignored env GIT_TRACE_PACKET

debug3: Ignored env _

debug3: Ignored env LaunchInstanceID

debug1: Sending env GIT_PROTOCOL = version=2

debug2: channel 0: request env confirm 0

debug3: send packet: type 98

debug3: Ignored env __CFBundleIdentifier

debug3: Ignored env PWD

debug3: Ignored env GVM_VERSION

debug3: Ignored env JAVA_HOME

debug1: Sending env LANG = en_US.UTF-8

debug2: channel 0: request env confirm 0

debug3: send packet: type 98

debug3: Ignored env gvm_pkgset_name

debug3: Ignored env XPC_FLAGS

debug3: Ignored env XPC_SERVICE_NAME

debug3: Ignored env SHLVL

debug3: Ignored env HOME

debug3: Ignored env GOROOT

debug3: Ignored env gvm_go_name

debug3: Ignored env GIT_SSH_COMMAND

debug3: Ignored env GIT_TRACE

debug3: Ignored env LOGNAME

debug3: Ignored env LESS

debug3: Ignored env GVM_OVERLAY_PREFIX

debug1: Sending env LC_CTYPE = en_US.UTF-8

debug2: channel 0: request env confirm 0

debug3: send packet: type 98

debug3: Ignored env GIT_CURL_VERBOSE

debug3: Ignored env PKG_CONFIG_PATH

debug3: Ignored env NVM_BIN

debug3: Ignored env GOPATH

debug3: Ignored env DISPLAY

debug3: Ignored env SECURITYSESSIONID

debug3: Ignored env GIT_EXEC_PATH

debug3: Ignored env GVM_PATH_BACKUP

debug1: Sending command: git-upload-pack '\[acctname\]/\[gitrepo\].git'

debug2: channel 0: request exec confirm 1

debug3: send packet: type 98

debug2: channel_input_open_confirmation: channel 0: callback done

debug2: channel 0: open confirm rwindow 2097152 rmax 32768

debug3: receive packet: type 99

debug2: channel_input_status_confirm: type 99 id 0

debug2: exec request accepted on channel 0

debug2: channel 0: rcvd ext data 10

debug3: receive packet: type 98

debug1: client_input_channel_req: channel 0 rtype exit-status reply 0

debug3: receive packet: type 96

debug2: channel 0: rcvd eof

debug2: channel 0: output open -\> drain

debug3: receive packet: type 97

debug2: channel 0: rcvd close

debug2: channel 0: chan_shutdown_read (i0 o1 sock -1 wfd 6 efd 8 \[write\])

debug2: channel 0: input open -\> closed

debug3: channel 0: will not send data after close

debug2: channel 0: obuf_empty delayed efd 8/(10)

Forbidden

debug2: channel 0: written 10 to efd 8

debug3: channel 0: will not send data after close

debug2: channel 0: obuf empty

debug2: channel 0: chan_shutdown_write (i3 o1 sock -1 wfd 7 efd 8 \[write\])

debug2: channel 0: output drain -\> closed

debug2: channel 0: almost dead

debug2: channel 0: gc: notify user

debug2: channel 0: gc: user detached

debug2: channel 0: send close

debug3: send packet: type 97

debug2: channel 0: is dead

debug2: channel 0: garbage collecting

debug1: channel 0: free: client-session, nchannels 1

debug3: channel 0: status: The following connections are open:

#0 client-session (t4 r0 i3/0 o3/0 e\[write\]/0 fd -1/-1/8 sock -1 cc -1)

debug3: send packet: type 1

debug1: fd 0 clearing O_NONBLOCK

debug3: fd 1 is not O_NONBLOCK

Transferred: sent 3596, received 2324 bytes, in 0.1 seconds

Bytes per second: sent 41357.6, received 26728.3

debug1: Exit status 1

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

\`\`\`


Answers:
author: Theodora Boudale
body: Hi [@Adam Lucia](/t5/user/viewprofilepage/user-id/4701850),

Have you been able to resolve this with CCM's suggestion or do you still need assistance?

In case you have multiple SSH keys in your \~/.ssh directory and you only use one for Bitbucket, you can also add the following in the **config** file of your **\~/.ssh** directory:

```
Host bitbucket.org
    HostName bitbucket.org
    User YourBitbucketUsername
    PreferredAuthentications publickey
    IdentityFile /Users/YourUser/.ssh/my_ssh_key
```

Replace **YourBitbucketUsername** with your Bitbucket username and **/Users/YourUser/.ssh/my_ssh_key** with the path to the private key that is added to your Bitbucket user.

If you have multiple SSH keys in \~/.ssh, then a different key may be offered that is added to another Bitbucket user or workspace.  
If you add the above configuration, you ensure that the proper key is offered by your client when you clone/push to Bitbucket.

<br />

If, however, you have multiple Bitbucket accounts and SSH keys for all of them on the same machine, you can check the article below for how to configure and use SSH:

* <https://blog.developer.atlassian.com/different-ssh-keys-multiple-bitbucket-accounts/>

Kind regards,  
Theodora

comments: author: Adam Lucia
body: This seemed to work! At least I noticed the repo cloned after I created the config file.


author: Theodora Boudale
body: That's good to hear, thank you for the update.

Please feel free to reach out if you ever need anything else!

Kind regards,  
Theodora


author: Pramodh M
body: Hi [@Adam Lucia](/t5/user/viewprofilepage/user-id/4701850)

Welcome to the Community!!

You should at least have read rights to clone the repo from Bitbucket

Navigate to the repository settings and add yourself with the necessary permissions to gain access to the repository!!

Thanks,  
Pramodh

comments: author: Adam Lucia
body: I tried your recommendations - it said I have implicit Admin access to the repository already.


author: Craig Castle-Mead
body: Hey [@Adam Lucia](/t5/user/viewprofilepage/user-id/4701850)

Given the debug log shows that the authentication is successful, my guess would be checking that the SSH key is definitely configured against the correct user. Apart from that (and you may well have done that already), nothing else stands out sorry

CCM


Tags: bitbucket-cloud

cloud