In our Continuous Integration environment we do very heavy usage of git clone
and git update
.
Sometimes the network or the central git server is not reliable.
Is there a way to tell git to retry if the http request failed?
Example:
500 Internal Server Error while accessing https://example.com/repos/foo_bar/info/refs?service=git-upload-pack
This is a wrapper around git commands, it recognizes when a command fails and retries
More information on this can be found here.
Run below command
No git itself, it does not support natively that feature.
But interestingly enough, the idea of wrapping a git command in order to retry its execution has been done before: see "
git-retry
(1) Manual Page ", part of depot_tools, a collection of tools for dealing with Chromium development.The shell wrapper
git-retry
calls the python scriptgit_retry.py
with the following options:Note: a git clone for a repo with submodule will always try to clone a submodule twice (one retry). See "Is there any way to continue Git clone from the point where it failed?".
You could run a script like this instead of calling git directly.