Is there any way to do git through http timeout?

I have a script running git clone / pull automatically (this actually happens inside jenkins CI, but my question is more general). The remote git server is based on HTTPS. The device with the git client has a weak DSL Internet connection, so it sometimes restores and changes the IP address, losing all existing connections. When the connection fails while the git client is running, the client never succeeds, but it does not interrupt with a timeout, so my script freezes.

I would like to configure the client so that it stops working after some period (therefore, the script can try again, or register a failure, or take any other action). But I did not find any timeout option in the git -config man page. I found a related question , but this is only for SSH connections. Do you know if there is an alternative for http servers?

+10
git timeout jenkins
source share
3 answers

You can try using

http.lowSpeedLimit, http.lowSpeedTime

If the HTTP transfer rate is less than http.lowSpeedLimit for longer than http.lowSpeedTime seconds, the transfer is aborted. Can be overridden by GIT_HTTP_LOW_SPEED_LIMIT and Environment GIT_HTTP_LOW_SPEED_TIME variables.

+7
source

In addition to the answer to the flooring:

Also

git config --global http.lowSpeedLimit 1000 git config --global http.lowSpeedTime 600 

works great.

The above example means that the remote action will be blocked, if the speed is lower than 1 KB / s for 600 seconds (10 minutes), the action will be blocked.

+8
source

Add this to .gitconfig ...

 [http] lowSpeedLimit = 1000 lowSpeedTime = 20 

lowSpeedLimit is bytes per second

I call it the Codeplex proposal.

+2
source

All Articles