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

could not read from remote repository

robertolo January 16, 2019

Hi,

I am going today through connectivity problems to my bitbucket repositories. It does not seem a client issue as I can reproduce the same problem in my two machines. Neither an internet connection problem on my side, as I can reproduce through two different networks (home connection and cell phone tethering).

The sympthoms are as follow:

$ git pull
Enter passphrase for key '/home/roberto/.ssh/id_bitbucket':
Connection to bitbucket.org closed by remote host.
fatal: Could not read from remote repository.

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

Same exact message in both machines. I have tried the following also:

$ ssh -v git@bitbucket.org
OpenSSH_7.6p1 Ubuntu-4ubuntu0.1, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /home/roberto/.ssh/config
debug1: /home/roberto/.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 [18.205.93.2] port 22.
debug1: Connection established.
debug1: identity file /home/roberto/.ssh/id_bitbucket type 0
debug1: key_load_public: No such file or directory
debug1: identity file /home/roberto/.ssh/id_bitbucket-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.1
debug1: Remote protocol version 2.0, remote software version conker_1.1.17-9953920 app-130
debug1: no match: conker_1.1.17-9953920 app-130
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: ssh-rsa
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: ssh-rsa SHA256:zzXQOXSRBEiUtuE8AikJYKwbHaxvSc0ojez9YXaGp1A
debug1: Host 'bitbucket.org' is known and matches the RSA host key.
debug1: Found key in /home/roberto/.ssh/known_hosts:31
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_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:KwjrafCTA0P4mDiNqNztGEmmYkpdcGN633rHnL81AEM /home/roberto/.ssh/id_bitbucket
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([18.205.93.2]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LC_MEASUREMENT = es_ES.UTF-8
debug1: Sending env LC_PAPER = es_ES.UTF-8
debug1: Sending env LC_MONETARY = es_ES.UTF-8
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending env LC_NAME = es_ES.UTF-8
debug1: Sending env LC_ADDRESS = es_ES.UTF-8
debug1: Sending env LC_NUMERIC = es_ES.UTF-8
debug1: Sending env LC_TELEPHONE = es_ES.UTF-8
debug1: Sending env LC_IDENTIFICATION = es_ES.UTF-8
debug1: Sending env LC_TIME = es_ES.UTF-8
debug1: channel 0: free: client-session, nchannels 1
Connection to bitbucket.org closed by remote host.
Connection to bitbucket.org closed.
Transferred: sent 3468, received 1640 bytes, in 20.1 seconds
Bytes per second: sent 172.4, received 81.5
debug1: Exit status -1

I do not know how to continue from this point. Any hints?

Thanks in advance.

20 answers

2 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

9 votes
Answer accepted
robertolo January 30, 2019

Today this problem just disappeared from all my devices. I am able to pull, push, clone, etc. without problem. Flush! Server side problem + fix, I guess. That's fine.

BUT

How does Atlassian ever want to make the community engaged with their products with such service bumps? Two weeks! I even had to create a git server at home to be able to continue work. I am sure that I was not the only one with this problem, my setup is simple (standard git + openssh).

The worst part was the feeling that nobody really cared about this issue. That I would not even be able to clone my git repos (and maybe move somewhere else).

Thank you for the fix, but my trust on bitbucket has got much weaker after this issue.

Jerald S M March 10, 2020

I'm facing a similar issue, since days :(

I'm working now with newly generated ssh-keys

Like # people like this
markwilx February 14, 2021

I’m having the same problem right now, also for days.  I was working along just fine with my repository.  A little more than a week ago, it stopped working.  I got a notice from Atlassian that bitbucket was having problems.  The next day, my repository was working fine again.  A couple days after that, it stopped working again (no notice this time).  It’s been several days now, and I still can’t write to [edit: or read from] my repository.

As robertolo surmised, this is probably a server side error.

Mark

 

Update:  I did as Scott Dudley _Cenote_ suggested (below) and installed new SSH keys.  This did not solve the problem.  However, in troubleshooting, I did discover that the command

ssh -T git@bitbucket.org

Produced the error “Connection closed by [IP address] port 22” whenever I was connected to my VPN (specifically, NordVPN).  When I was not connected to my VPN, the command produced the expected output indicating I was logged in by my username.  Thus, I can conclude my SSH keys are now working properly.

However, attempts to push my code updates, even when my VPN is disconnected, produce the error message, “Connection to bitbucket.org closed by remote host.  fatal: the remote end hung up unexpectedly”

I’ll keep updating here until resolved.

Like Deleted user likes this
4 votes
Answer accepted
Scott Dudley _Cenote_ January 30, 2020

At least in the situation where there is a "broken pipe" error message like this:

Cloning into 'reponame'...
packet_write_wait: Connection to a.b.c.d port 7089: Broken pipe
fatal: Could not read from remote repository.

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

I was able to get this to work by adding the following to the ~/.ssh/config file on the client machine:

IPQoS=throughput

For what it is worth, the client was a VM guest. For some of the other people that experienced issues only when using/not using a VPN, maybe this might be relevant too.

kjetilsk March 24, 2021

Thanks! I'm in a VM too. This worked for me:

export GIT_SSH_COMMAND="ssh -o IPQoS=throughput -i /home/USERNAME/.ssh/id_rsa_bitbucket"
git clone ssh://USERNAME@bitbucket.org/WORKSPACE/REPO.git
Like # people like this
Sadat Hussain August 22, 2021

It resolved for me after connecting to VPN

33 votes
Maze Hawks August 11, 2019

This happens because the SSH key needs to be addressed to the user account, not the repository itself.

lapalmabynight September 10, 2019

This is the solution!

Like # people like this
fusion27 September 16, 2019

🔥️Cooking with gas🔥️

Roberto López López September 30, 2019

This was not the solution, this was checked from minute 1

Like # people like this
mkochco November 5, 2019

Don't think this is the issue.  `ssh -Tv git@bitbucket.org` show that SSH Auth actually works.  Something else is preventing further communication.

Like AJ Otto likes this
umassthrower November 13, 2019

I made this screenshot for a collaborator.  This is really easy to do incorrectly. I'd argue the "incorrect" path is easier and more in your face when you create a new repository than the "correct" location. Hope this helps someone.

Screen Shot 2019-11-13 at 9.16.07 AM.png

Like # people like this
robertolo November 13, 2019

Not. As @mkochco is pointing out, SSH authentication is actually working. It is something else which causes this error.

gonzalo_g December 21, 2019

Thanks!

Ben Retan February 12, 2020

Thank you @umassthrower !!!

I literally searched for hours to solve this problem and you gave an incredibly detailed visual guide on how to resolve the problem. It's specific to the UI of this platform and I'm not sure why this has not been addressed, but thank you so much for your contribution!

Like # people like this
Julian Misiukievič February 28, 2020

Thank you. FYI: adding the key to repository works in read mode, i was able to pull changes, but wasn't able to push

Like # people like this
germanoricardi June 11, 2020

Foi a solução perfeita, a chave ser informada no meu perfil e não no repositório.

fernando_avila June 26, 2020

Thanks a lot @umassthrower 

Bharath June 21, 2021

Thank you @umassthrower  for the detailed screenshot. I was looking for a solution and found the straight answer here.

moita69 January 26, 2022

Thank you @umassthrower 

For me this is a bug, where you can read for clone but no for push, or the log could be better. in my case

omir85 June 8, 2022

Thanks @umassthrower for your answer, I managed to solve it.

Who knew, two and a half years later, the UI is still misleading. Atlassian in a nutshell I guess :)

Like AJ Otto likes this
Miszczu February 27, 2023

This way machine will have your main user full access to all your repos...! are you really advices that?

12 votes
Marcello Verona March 2, 2020

I resolved with this simple trick 

  1. Remove the SSH key from the repo. (Click on repo name > Settings > Access Keys)
  2. Add SSH key to Account settings SSH keys. (Click on your avatar > Bitbucket Settings > SSH Keys)

(found on StackOverflow: https://stackoverflow.com/questions/56828685/cant-git-push-to-bitbucket-unauthorized-fatal-could-not-read-from-remote-re/56828686#56828686).

Michael_Pierre March 8, 2020

@Marcello Verona Thank you very much! Your answer solved my read-only error when trying to push to my bitbucket repo. I did infact save my public key in my repo's "Access key" setting, rather than my bitbucket account's "SSH key" settings. Deleting the key from the Access key and pasting it to SSH key settings resolved this issue.

Hung_Doan_Sy May 29, 2020

This works like a charm !!!

rb June 19, 2020

Thanks a lot. This answer should be pin on top of the thread.

Jan P Springer June 20, 2020

unfortunately, in my case the problem persists with *no* keys on the repo but keys on the account; in fact the repo never had keys at all.

Jianhua Ma July 7, 2020

God damn! This solve my issue stucking me for half day!

cityshark October 31, 2020

Works like a charm!


Sean O'Brien May 21, 2021

None of this interface is available anymore. Where would I go to get my SSH keys to work for BitBucket now that the interface has changed?

Deleted user April 4, 2022
Miszczu February 27, 2023

This way machine will have your main user full access to all your repos...! are you really advices that.. I can not believe people can advice that!

8 votes
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 18, 2019

Hi Roberto!

Is your SSH correctly added to your SSH agent? You can check that by running the following command on your terminal:

ssh-add -L

If your key is not there, you can add it by doing:

ssh-add <path_to_key>

If your key is there, you can check if it's associated to the right Bitbucket account by running:

ssh -Tv git@bitbucket.org

If all the above seems to be ok, can you try to pull over https instead of ssh and tell us if you till get an error?

Let us know!
Ana

Eloi Moreira Mendes October 18, 2019

Worked for me! Thanks!

Like Adeela Saalim likes this
Ben Winding November 7, 2019

So this command

ssh -Tv git@bitbucket.org

Gives me:

logged in as benwinding

But trying to pull a repository, gives me

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

 Any ideas?...

Like # people like this
Ben Winding November 7, 2019

I deleted the old keys and readded a new SSH key, now it works???

Praveen February 17, 2020

I am still facing the issue.

I  run the commands which you mentioned above and i am able to add the keys to SSH agent but still getting below error. while i am pushing the code.

 

fatal: Could not read from remote repository.

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

Adeela Saalim June 5, 2020

This worked for me. Thank you.

Stanislav Stankov September 15, 2020

Thanks Ana! Lots of love for you!

frank.hoffsummer December 10, 2020

FYI the ssh -T command mentioned here is misleading!

As long as you have an ssh key configured on your Bitbucket account https://bitbucket.org/account/settings/ssh-keys/, the following command will report success, no matter the key that you're using to connect to BitBucket

$ ssh -Tv git@bitbucket.org
...
...
debug1: Authentication succeeded (publickey)
...
...

I tried two different ~/.ssh/config configurations to verify this. One with the actual key that I have configured in https://bitbucket.org/account/settings/ssh-keys/

Host bitbucket.org
HostName bitbucket.org
User git
IdentityFile ~/.ssh/id_rsa_bitbucket

The ssh command returns "Authentication succeeded" and error code 0.

Then I changed the BitBucket section in my ~/.ssh/config to use a key that exists on my file system, but is not configured here https://bitbucket.org/account/settings/ssh-keys/

Host bitbucket.org
HostName bitbucket.org
User git
IdentityFile ~/.ssh/id_rsa

...and the ssh command still returns "Authentication succeeded" and error code 0.

¯\_(ツ)_/¯

5 votes
osroflo July 27, 2020

This worked for me:

~/.ssh/config

 

Host bitbucket.org
Hostname bitbucket.org
User git
IdentityFile ~/.ssh/bitbucket_id_rsa
IdentitiesOnly yes
jalangle August 8, 2020

This is what worked for me as it bypassed my agent forwarding and forced me to have the key local to the box.  Not ideal, but it worked.

tjcccc September 30, 2020

Worked for me!

Thank you!

Deleted user January 28, 2021

Ah finally, after days of struggling with this issue, this solution works. Thank you!

3 votes
mkochco February 25, 2020

We experienced this issue and finally tracked it down to an issue with IP QoS settings.  I don't think this has anything to do with Bitbucket.  Instead it has everything to do with the route you take to Bitbucket and how the default SSH client IP QoS exposes issues with certain network equipment.  We worked around the issues by adding the following to `/etc/sshd/ssh_config`

Host *
IPQoS 0x00
robertolo February 25, 2020

Very good, thanks - first reasonable answer in the whole thread. Unfortunately I cannot check this any more, I hope this could help others.

I have read somewhere else, that `IPQoS=throughput` can be also helpful.

Like # people like this
Guido Ortega August 10, 2020

Thank you, this solves my problem.

myzticman January 30, 2021

This also resolved my problem. Thanks @mkochco

2 votes
John Smith February 24, 2020

Has this been solved yet Atlassian ? - this is a really hard to troubleshoot problem.

The SSH connection is fine, nothing is wrong with the keys (it accepts public key auth), please tell us why this is failing.

robertolo February 25, 2020

I guess they know from the beginning, from time to time they have such service (long) hiccups.

My original question dates from over a year ago.

Apparently they just do not give a shit about free tier users. They don't realize that these free tier users could potentially become paying customers, and they are just building a very bad reputation.

John Smith February 25, 2020

The thing is - this doesn't just affect free tier users - this is effecting a bitbucket DC user.

Like robertolo likes this
robertolo February 25, 2020

look at mkochco answer further down this thread - may work for you

2 votes
iMakedonsky February 21, 2020

Me too experiencing this issue now.

2 weeks ago everything worked, now it's broken. What the hell?
Didn't change my keys, debug recognizes me correctly, yet i still can't pull or push to same repository i worked with 2 weeks ago!

a2Xn1ahw5aw4rg

2 votes
philmill June 13, 2019

I don't have an answer but I'm having the exact same issue. I can fetch from a Bitbucket repo from my office network, but when I get home I get the same error as reported. 

fatal: Could not read from remote repository.
Please make sure you have the correct access rights


Running `ssh -Tv git@bitbucket.org` I can confirm that succeeds from the following

debug1: Authentication succeeded (publickey).

Authenticated to bitbucket.org ([2406:da00:ff00::6b17:d1f5]:22).

Super mysterious. I use the same SSH keys on GitHub just fine from home and office so my SSH client is working. 

macOS 10.14.5

git version 2.22.0

openssl: stable 1.0.2s (bottled) [keg-only]

ssh -V reports "OpenSSH_7.9p1, LibreSSL 2.7.3"

 

 

1 vote
paulmspex May 5, 2021

I had an issue similar to frank_hoffsummer's problem. 

I found the problem to be that I have multiple identities on bitbucket.org, and different ssh keys associated with each one. The clue was noticing the result of doing `ssh -T git@bitbucket.org`. The response that I got was 

plsuh@Paul-MacBook-Air ~ % ssh -T git@bitbucket.org
logged in as paul_suh

You can use git to connect to Bitbucket. Shell access is disabled
plsuh@Paul-MacBook-Air ~ %

Note the username that I highlighted in bold. That was the wrong account on bitbucket.org for the repository I was trying to push to.

The ssh keys are added to ssh-agent in a non-deterministic order for each time that you log in to your local machine (unless you do something special). As a result, sometimes the key for one account was tried first, at other times the key for a different account was tried first. Each login succeeded, but one account didn't have the correct access rights while the other one did. 

I solved the immediate problem by removing all but one key from ssh-agent. 

In the long run, I will need to set up something like the solutions in this Stack Overflow question: 

https://stackoverflow.com/questions/6688655/select-private-key-to-use-with-git

In particular, ignore the "accepted" answer and look at the one below it by Richard Smith. 

1 vote
eagleas June 17, 2019

Same problem!

```
debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([18.234.32.155]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LC_ALL = en_US.UTF-8
debug1: Sending env LANG = ru_RU.UTF-8
debug1: Sending env LC_CTYPE = UTF-8
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2772, received 1640 bytes, in 10.1 seconds
Bytes per second: sent 273.6, received 161.9
debug1: Exit status -1
```

When I use VPN - all OK. What the problem?

eagleas June 17, 2019

Retring ssh -Tv git@bitbucket.org to another IP from list:

$ host bitbucket.org
bitbucket.org has address 18.234.32.157
bitbucket.org has address 18.234.32.156
bitbucket.org has address 18.234.32.155

with another result:

----

debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([18.234.32.157]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LC_ALL = en_US.UTF-8
debug1: Sending env LANG = ru_RU.UTF-8
debug1: Sending env LC_CTYPE = UTF-8
logged in as eagleas

You can use git or hg 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 2772, received 1832 bytes, in 0.3 seconds
Bytes per second: sent 10890.2, received 7197.3
debug1: Exit status 0
----

debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([18.234.32.156]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LC_ALL = en_US.UTF-8
debug1: Sending env LANG = ru_RU.UTF-8
debug1: Sending env LC_CTYPE = UTF-8
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
logged in as eagleas

You can use git or hg to connect to Bitbucket. Shell access is disabled
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2772, received 1832 bytes, in 0.3 seconds
Bytes per second: sent 10967.8, received 7248.6
debug1: Exit status 0

----


and again .155:

debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([18.234.32.155]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LC_ALL = en_US.UTF-8
debug1: Sending env LANG = ru_RU.UTF-8
debug1: Sending env LC_CTYPE = UTF-8
packet_write_wait: Connection to 18.234.32.155 port 22: Broken pipe


It seems to me - problem with server on IP: 18.234.32.155. Please, look into this.
This problem exists for a long time.

Like # people like this
Matt R September 30, 2019

Wow you're right. I have had the same problem for months
https://community.atlassian.com/t5/Git-questions/Unable-to-access-repo-via-SSH-fatal-Could-not-read-from-remote/qaq-p/1075122

As soon as I connect to VPN, git ls-remote suddenly succeeds

mkochco November 5, 2019

Same issue today Tues Nov 5.  Hey Atlassian why is this happening?

Ben Winding November 7, 2019

If VPN's work, does this mean it could be geolocation-based?

Some IP Adresses could be refused based on their location :sad

1 vote
Pablo Demian June 4, 2019

Same problem here

Authenticated to bitbucket.org ([18.205.93.2]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: channel 0: free: client-session, nchannels 1
Connection to bitbucket.org closed by remote host.
Transferred: sent 2520, received 1580 bytes, in 0.0 seconds
Bytes per second: sent 53653025.8, received 33639595.5
debug1: Exit status -1
0 votes
bqliu93 September 19, 2021

A lot of mis-configurations can result in this issue. For me for example, I moved my repo from one workspace to another so the git url of the repo changed. I initially forgot to updated the remote url in my local repository, and the same error popped up when I tried to push. 

 

After updating the remote url then everything worked again.

0 votes
frank.hoffsummer December 10, 2020

I had the exact same problem, and after reading through this entire thread, none of the solutions offered here did it for me. After lots of trial and error, I found the solution for me

I have the public ssh key that I want to use with BitBucket configured on my bitbucket.org account page https://bitbucket.org/account/settings/ssh-keys/

The version of my ~/.ssh/config file that didn't work for me looked like this

Host *
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly yes
UseKeychain yes
AddKeysToAgent yes
Compression yes
StrictHostKeyChecking no
ForwardAgent yes
ForwardX11 no
ServerAliveInterval 600

Host bitbucket.org
HostName bitbucket.org
User git
IdentityFile ~/.ssh/id_rsa_bitbucket

so I have one key that I want to use as default (~/.ssh/id_rsa configured in "Host *" section) and another that I want to use with BitBucket (~/.ssh/id_rsa_bitbucket configured in "Host bitbucket.org" section)

While this setup is working with any other site I need to use git or ssh with (e.g. github.com), it doesn't with Bitbucket. So removing the first default key (~/.ssh/id_rsa configured in "Host *" section) did the trick. The working ~/.ssh/config file now looks like this

Host *
IdentitiesOnly yes
UseKeychain yes
AddKeysToAgent yes
Compression yes
StrictHostKeyChecking no
ForwardAgent yes
ForwardX11 no
ServerAliveInterval 600

Host bitbucket.org
HostName bitbucket.org
User git
IdentityFile ~/.ssh/id_rsa_bitbucket

 

Cole Tierney July 15, 2022

Thank you! Removing the default entry `IdentityFile ~/.ssh/id_rsa` from `Host *` solved this problem for me.

0 votes
Siva Gannavarapu December 9, 2020

I've multiple routers in my house. When i switched the WIFI to the new one, git wont push and gives me this error, but when connected to the old WIFI, and it works. Weird!

Platform : git bash - windows 10

0 votes
Nate Cheng August 29, 2020

This is really confusing when I have multiple project in github, bitbucket's different accounts.

I removed the SSH key from repo, but add SSH key into the account bucket setting, then it works fine.

0 votes
Jan P Springer June 9, 2020

this is still going on. ssh keys are installed in the user profile. i can pull but not push, same mysterious error message.

0 votes
ricardoPT April 24, 2020

Actually I was having this problem on a Mac, after trying some solutions I just restarted the computer and BANNG... it worked fine again!

0 votes
robertolo January 18, 2019

Hi Ana, thanks for your answer,

The ssh key seems to be correctly added to the ssh agent, but still bitbucket.org is kicking me out without any further explanation...

$ ssh-add -L
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQ ... WwksXHHvXIFbIp /home/roberto/.ssh/id_bitbucket


$ cat ~/.ssh/config
Host bitbucket.org
HostName bitbucket.org
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_bitbucket


$ ssh -Tv git@bitbucket.org
OpenSSH_7.6p1 Ubuntu-4ubuntu0.1, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /home/roberto/.ssh/config
debug1: /home/roberto/.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 [18.205.93.1] port 22.
debug1: Connection established.
debug1: identity file /home/roberto/.ssh/id_bitbucket type 0
debug1: key_load_public: No such file or directory
debug1: identity file /home/roberto/.ssh/id_bitbucket-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.1
debug1: Remote protocol version 2.0, remote software version conker_1.1.17-9953920 app-155
debug1: no match: conker_1.1.17-9953920 app-155
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: ssh-rsa
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: ssh-rsa SHA256:zzXQOXSRBEiUtuE8AikJYKwbHaxvSc0ojez9YXaGp1A
debug1: Host 'bitbucket.org' is known and matches the RSA host key.
debug1: Found key in /home/roberto/.ssh/known_hosts:31
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_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:KwjrafCTA0P4mDiNqNztGEmmYkpdcGN633rHnL81AEM /home/roberto/.ssh/id_bitbucket
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to bitbucket.org ([18.205.93.1]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LC_MEASUREMENT = es_ES.UTF-8
debug1: Sending env LC_PAPER = es_ES.UTF-8
debug1: Sending env LC_MONETARY = es_ES.UTF-8
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending env LC_NAME = es_ES.UTF-8
debug1: Sending env LC_ADDRESS = es_ES.UTF-8
debug1: Sending env LC_NUMERIC = es_ES.UTF-8
debug1: Sending env LC_TELEPHONE = es_ES.UTF-8
debug1: Sending env LC_IDENTIFICATION = es_ES.UTF-8
debug1: Sending env LC_TIME = es_ES.UTF-8
debug1: channel 0: free: client-session, nchannels 1
Connection to bitbucket.org closed by remote host.
Transferred: sent 3136, received 1640 bytes, in 20.5 seconds
Bytes per second: sent 153.2, received 80.1
debug1: Exit status -1


$ git pull
Connection to bitbucket.org closed by remote host.
fatal: Could not read from remote repository.

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

 Also, the SSH key seems to be already included in my bitbucket.org settings...

Untitled.png

 

This really happened from one day to the next one. All repositories which I had been using since years ago, suddenly became unreachable without me touching the ssh config at all (in my two computers at the same time). Do you have any further idea? Thanks :-)

Regards,

Roberto

Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 31, 2019

Hi Roberto,

Did you use sudo? This is a very common mistake and is explained here.

If that's not your case:

  1. Did you already navigate to your repo directory before the pull?
  2. For troubleshooting purposes, have you tried HTTPS instead of SSH?
  3. Can you confirm you have the right permissions for the repo you're trying to pull?

Let us know!

Ana

robertolo February 1, 2019

Hola Ana,

Thank you for your answer. Some post-mortem answers:

  • sudo: not.
  • Yes, I had cloned/pulled/pushed to all these repositories before the incident.
  • I really cannot remember if I tried HTTPS, I guess I did. 2 weeks of downtime and desperation are enough to try many options.
  • Yes, I had the right permissions. I am the owner, basically. I double checked that my SSH key was properly set up here and in server, as you can see in the logs above ("debug1: Authentication succeeded (publickey)").

Luckily now my repos are back to normal as I posted before.

Kind regards,

Roberto

Like sergii_shapovalenko likes this

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events