Missed Team ’24? Catch up on announcements here.

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

Increase ssh connection timeout

Paulo Guedes
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 9, 2021

I keep getting the error "Connection to bitbucket.org 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.
November 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,
Theodora

Paulo Guedes
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 10, 2021

Hi,
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.
November 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 bitbucket.org).

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:

Host bitbucket.org
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,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events