13

all questions I found want to avoid timeouts in git push/pull. In my case I want to force them. My push + pulls are all going over ssh to remote machines that might be unavailable at some point in time. For example, I have a script that pushes to two remote public repos. I don't want that this script hangs forever when it pushes to the first repo and that machine is unavailable. Instead, after some timeout i want the push to fail and continue with the second repo.

Any options here?

2 Answers 2

14

I don’t think you can do an automatic fail-over with built-in features. But since Git just uses SSH underneath, it should work to add a ConnectTimeout option for the machines in question in your .ssh/config. Cf. man ssh_config. Then something like git push foo || git push bar in the shell should do what you want.

Sign up to request clarification or add additional context in comments.

1 Comment

Hi, do both of them use ssh ? [email protected]:neovim/neovim.git github.com/neovim/neovim.git
1

git config settings for using http for transfers:

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 the GIT_HTTP_LOW_SPEED_LIMIT and GIT_HTTP_LOW_SPEED_TIME environment variables. documentation for Git config

e.g., add to your .gitconfig:

  # Abort if transfer speed is less than 1000 bytes/second for more than 5 seconds
  lowSpeedLimit = 1000
  lowSpeedTime = 5

or, using environment variables, e.g.,

$ GIT_HTTP_LOW_SPEED_LIMIT=1000 GIT_HTTP_LOW_SPEED_TIME=5 git pull

2 Comments

What is Codeplex tweak ?
Codeplex was really slow so I had to set this to get it to work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.