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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Increase ssh connection timeout

I keep getting the error "Connection to closed by remote host." because my git hooks take long to complete, is there a way to increase the connection timeout?

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Nov 10, 2021

Hi Paulo,

Could you please let us know
1. What operation gives you that error? Is it clone, pull or push?
2. What kind of hooks are you using, is it a client-side pre-push hook or something else?
3. How long approximately after you start the operation do you see it timing out?
4. What OS and SSH client are you using? I'm asking because SSH configuration is set differently depending on that.

Kind regards,

Here are the answers:

1 - It's a push.
2 - Yes, a client side pre-push hook.
3 - Around 3-4 minutes.
4 - Mac OS.

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Nov 12, 2021

Hi Paulo,

Thanks for the info. I would suggest first checking the files /etc/ssh/ssh_config file (system-wide ssh configuration) and ~/.ssh/config (ssh configuration for your user) in your laptop, and see if there are any values set for ServerAliveInterval and ServerAliveCountMax (either for Host * or for Host

If you don't see these options in any of the two files, what you can do to keep the connection open for longer would be to add the following in either of the files:

ServerAliveInterval 300
ServerAliveCountMax 2

The above values are just an example and you can adjust them depending on how long your hook needs to finish. What these settings will do is make your SSH client send a null packet to Bitbucket every 300 seconds (5 minutes) and give up if it doesn't receive a response after 2 tries. This will give you 10 minutes before the connection times out, if the hook takes longer to complete you can set a higher value to either or both of the options.

Please feel free to let me know how it goes and if you need anything further.

Kind regards,

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events