Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

access to repository via ssh fails but https work

Recently, I am not able to access repository via SSH-key (it was working one month ago). When I run push/pull, I receive (after around one minute):


Connection to closed by remote host.
fatal: Could not read from remote repository.

When I change it to HTTPS (git remote set-url origin ...) then it works.

I was thinking that it might be a temporary issue, but I had this problem in previous week in one repository, and now, SSH fails in another repository, so I thing something is wrong.

Best regards,


1 answer

1 accepted

1 vote
Answer accepted

I remember that Bitbucket had SSH issues a month or so but was resolved after a while. However, this might be also a network issue on your end. Are you on a corporate network or home network? I'm asking because I experienced this problem before and what I did was to use VPN. Not ideal but it worked.


Also, have you tried restarting your machine?

I'm using home network, but with my company's VPN turned on it also doesn't work.
Restarting doesn't help.

When I run ssh -v then I receive

OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017 
debug1: Connecting to [] port 22.
debug1: Connection established.
debug1: Server host key: ssh-rsa SHA256:zzXQOXSRBEiUtuE8AikJYKwbHaxvSc0ojez9YXaGp1A
debug1: Host '' is known and matches the RSA host key.
debug1: Found key in /home/andrzej/.ssh/known_hosts:62
debug1: Next authentication method: publickey
debug1: Offering public key: RSA (...)
debug1: Server accepts key: pkalg ssh-rsa blen 535
debug1: Authentication succeeded (publickey).
Authenticated to ([]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LC_TIME = pl_PL.UTF-8

(now it stops for a few seconds)
and then it fail with the following message

debug1: channel 0: free: client-session, nchannels 1 
Connection to closed by remote host.
Connection to closed.
Transferred: sent 4236, received 1848 bytes, in 20.1 seconds
Bytes per second: sent 210.5, received 91.8
debug1: Exit status -1

The problem is indeed in my network. I encounter the same problem when logging via ssh to some other remote machine. When I connect to another network (e.g. through mobile connection) it works.

Like Jack likes this

Awesome. Well, not awesome that this problem exists but at least we have a successful workaround. 

Fortunately, in our cases the other network works fine. But what if you have no other choice? I'm going to investigate what might be wrong on the network side.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,166 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you