suddenly not able to pull on server via ssh
Asked by ?kos Laczk?:

Hi folks,

I have a problem pulling from our repo via ssh on our server. We have used the current setup for years, without any problem.

But suddenly:

```
$ git pull 
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. 
fatal: Could not read from remote repository. 

Please make sure you have the correct access rights
```

Interesting thing is:

```
$ ssh -T git@bitbucket.org       
authenticated via ssh key. 

You can use git to connect to Bitbucket. Shell access is disabled
```

Debugging neither shows any error as far as I can tell:

```
$ ssh -Tv git@bitbucket.org 
OpenSSH_7.6p1 Ubuntu-4ubuntu0.5, OpenSSL 1.0.2n  7 Dec 2017 
debug1: Reading configuration data /home/siteuser/.ssh/config 
debug1: /home/siteuser/.ssh/config line 1: Applying options for bitbucket.org 
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: /etc/ssh/ssh_config line 19: Applying options for * 
debug1: Connecting to bitbucket.org [104.192.141.1] port 22. 
debug1: Connection established. 
debug1: identity file /home/siteuser/.ssh/id_rsa type 0 
debug1: key_load_public: No such file or directory 
debug1: identity file /home/siteuser/.ssh/id_rsa-cert type -1 
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.5 
debug1: Remote protocol version 2.0, remote software version conker_79d40d7e32 81a2932be6d9 
debug1: no match: conker_79d40d7e32 81a2932be6d9 
debug1: Authenticating to bitbucket.org:22 as 'git' 
debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug1: kex: algorithm: curve25519-sha256@libssh.org 
debug1: kex: host key algorithm: ecdsa-sha2-nistp256 
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none 
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none 
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY 
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:FC73VB6C4OQLSCrjEayhMp9UMxS97caD/Yyi2bhW/J0 
debug1: Host 'bitbucket.org' is known and matches the ECDSA host key. 
debug1: Found key in /home/siteuser/.ssh/known_hosts:5 
debug1: rekey after 134217728 blocks 
debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS 
debug1: SSH2_MSG_NEWKEYS received 
debug1: rekey after 134217728 blocks 
debug1: SSH2_MSG_EXT_INFO received 
debug1: kex_input_ext_info: server-sig-algs=<ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,rsa-sha2-256,ecdsa-sha2-nistp384,ssh-dss,ecds
a-sha2-nistp256,ecdsa-sha2-nistp521,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ssh-rsa,rsa-sha2-512> 
debug1: SSH2_MSG_SERVICE_ACCEPT received 
debug1: Authentications that can continue: publickey 
debug1: Next authentication method: publickey 
debug1: Offering public key: RSA SHA256:KwwRBC7De3QMdypLtVYdmH3vB1hT7oNs4Hl9ieZIEsA /home/siteuser/.ssh/id_rsa 
debug1: Server accepts key: pkalg rsa-sha2-512 blen 279 
debug1: Authentication succeeded (publickey). 
Authenticated to bitbucket.org ([104.192.141.1]:22). 
debug1: channel 0: new [client-session] 
debug1: Entering interactive session. 
debug1: pledge: network 
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0 
debug1: Sending environment. 
debug1: Sending env LC_ALL = en_US.UTF-8 
debug1: Sending env LC_MEASUREMENT = hu_HU.UTF-8 
debug1: Sending env LC_PAPER = hu_HU.UTF-8 
debug1: Sending env LC_MONETARY = hu_HU.UTF-8 
debug1: Sending env LANG = en_US.UTF-8 
debug1: Sending env LC_NAME = hu_HU.UTF-8 
debug1: Sending env LC_ADDRESS = hu_HU.UTF-8 
debug1: Sending env LC_NUMERIC = hu_HU.UTF-8 
debug1: Sending env LC_MESSAGES = C 
debug1: Sending env LC_TELEPHONE = hu_HU.UTF-8 
debug1: Sending env LC_IDENTIFICATION = hu_HU.UTF-8 
debug1: Sending env LC_TIME = hu_HU.UTF-8 
authenticated via ssh key. 

You can use git to connect to Bitbucket. Shell access is disabled 
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 
debug1: channel 0: free: client-session, nchannels 1 
Transferred: sent 3240, received 2456 bytes, in 0.2 seconds 
Bytes per second: sent 15004.6, received 11373.9 
debug1: Exit status 0

```

I've visited the SSH troubleshooting page, but cannot find anything relevant:

<https://confluence.atlassian.com/bbkb/troubleshooting-ssh-issues-302811847.html>

Your help is much appreciated!


Answers:
author: Patrik S
body: Hello [@?kos Laczk?](/t5/user/viewprofilepage/user-id/5320897) and welcome to the Community!

From the SSH logs, I see the following private key is being used to authenticate to Bitbucket Cloud :

```
/home/siteuser/.ssh/id_rsa
```

Could you please confirm if this is the correct key you want to use to authenticate and if the corresponding public key (a file in the same directory that ends with the extension .pub) was added to Bitbucket ?

Additionally, could you check if the public key was added to a user account (Personal Settings \> SSH Keys) or directly to a workspace/repository?

If the public SSH was added to a user account, this user must have access to the repository in question.

Thank you, [@?kos Laczk?](/t5/user/viewprofilepage/user-id/5320897) !

Patrik S


author: Jimmy.Diep
body: My guess is that the user you are using doesn't have access to the repos.

With your user, are you able to login to bitbucket.org and see the repos?

Check to see if you are using the same user when you do the git pull.

You can also try cloning the repos, does that work?


Tags: bitbucket-cloud

cloud