-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Problem
Cargo's net.retry configuration currently doesn't affect Git operations when they fail.
In enterprise environments, it's common to have internal Git servers hosting private dependencies. These servers often implement rate limiting to prevent overload, especially when many builds happen in parallel (CI/CD pipelines, multiple developers, etc.).
Currently, when the Git server returns a 429, the build fails immediately:
$ cargo build
remote: Too Many Requests
fatal: unable to access 'https://myserver:8888/git/': The requested URL returned error: 429
error: failed to get my_beauty_lib as a dependency of package ...
Am I wondering whether it could be an option to allow cargo git invocation retry in this case.
Proposed Solution
Extend Cargo's net.retry configuration (or introduce a new net.git-retry option) to handle Git operation retries, particularly for rate-limit (429) responses.
Notes
IINM, even with net.git-fetch-with-cli, it seems this is not possible, as it seems git does not support retry config; so the caller (cargo in this case) is required to implement the retry mechanism.