threads / discuss / 50283

git ls-remote: specifying connect timeout / retry limit

Subject: git ls-remote: specifying connect timeout / retry limit

## tl;dr

One message between Jan 22, 2019 and Jan 22, 2019.

replies: 0people: 1as markdown or json

Tim Heckman· Jan 22, 2019, 08:49 UTC · lore
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

← back to recent threads