I'm having a script running git clone/pull automatically (this is actually happening inside jenkins CI, but my question is more general). The remote git server is HTTPS based. The machine with the git client has a flaky DSL internet connection, so it sometimes reconnects and changes IP address, losing all its existing connections. When the connection fails while the git client is running, the client never succeeds but it doesn't fail with a timeout either, so my script hangs up.
I'd like to set up the client so it timeouts after some period (so the script can retry, or log a failure, or take any other action). But I didn't find any timeout option in the git-config manpage. I found a related question but it's only for SSH connections. Do you know if there's an alternative for http servers?
You can try using
http.lowSpeedLimit
,http.lowSpeedTime
:If the HTTP transfer speed, in bytes per second, is less than 'http.lowSpeedLimit' for longer than 'http.lowSpeedTime' seconds, the transfer is aborted.
Can be overridden by theGIT_HTTP_LOW_SPEED_LIMIT
andGIT_HTTP_LOW_SPEED_TIME
environment variables.
Git 2.41 (Q2 2023) added the unit for http.lowSpeedLimit
.
See commit 0aefe4c (13 May 2023) by Corentin Garcia (corenting
).
(Merged by Junio C Hamano -- gitster
-- in commit 1f141d6, 20 May 2023)
doc/git-config
: add unit for http.lowSpeedLimitSigned-off-by: Corentin Garcia
Add the unit (bytes per second) for
http.lowSpeedLimit
in the documentation.
git config
now includes in its man page:
If the HTTP transfer speed, in bytes per second, ...