在git push + pull中强制超时 [英] Forcing a timeout in git push + pull

查看:215
本文介绍了在git push + pull中强制超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现所有的问题都想避免在git push / pull中超时。在我的情况下,我想强迫他们。我的push + pull都会通过ssh发送到可能在某个时间点不可用的远程机器。例如,我有一个脚本推向两个远程公共回购站。我不希望这个脚本在推到第一个仓库时无法永久挂起,而且这台机器不可用。相反,经过一段时间后,我希望推送失败并继续进行第二次回购。

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?

推荐答案

我不认为您可以使用内置功能执行自动故障转移。但是由于Git只是在下面使用SSH,所以它应该可以为你的 .ssh / config ConnectTimeout 选项。 $ C>。参看 man ssh_config 。然后像 git push foo || git push bar 在shell中应该做你想做的。

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.

这篇关于在git push + pull中强制超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆