git ls-remote: specifying connect timeout / retry limit
- From
- Tim Heckman <t@heckman.io>
- Date
- Jan 22, 2019, 08:49 UTC
- Message-ID
- <CAB=D40guDg_bhFYGCYgpfKkqtMa49u1+=hqBHDWuoNwsQ4sxjw@mail.gmail.com>
Hello,
I've hit a particular situation where I've ran a `git ls-remote` command against a remote Bitbucket repository that resulted in the command hanging for a pretty long amount of time. Running strace shows that the TCP connect call eventually times out, and `git ls-remote` uses a default timeout period meaning it takes awhile to notice. If it retries different IPs, and they all fail, it can take many minutes for "git ls-remote" to return.
Is there a mechanism by which I can configure the connection timeout and retry count to have the `git ls-remote` command fail much faster? For my case I'd like a 15 second timeout and limiting retries to 2. Of course I plan on wrapping the command in a deadline itself, but I'd rather give it a bit more time to pull data if I'm on a slow/latent connection yet it was able to make the initial connection.
Digging through the manpage there's nothing jumping out at me at how to solve this so I thought I'd reach out here.
Cheers! -Tim