有没有办法使git超过http超时? [英] Is there a way to make git over http timeout?

查看:133
本文介绍了有没有办法使git超过http超时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自动运行git clone/pull的脚本(这实际上发生在jenkins CI中,但是我的问题更笼统).远程git服务器基于HTTPS.带有git客户端的计算机具有不稳定的DSL Internet连接,因此有时会重新连接并更改IP地址,从而丢失所有现有连接.当git客户端运行时连接失败时,客户端将永远不会成功,但也不会因超时而失败,因此我的脚本会挂起.

I'm having a script running git clone/pull automatically (this is actually happening inside jenkins CI, but my question is more general). The remote git server is HTTPS based. The machine with the git client has a flaky DSL internet connection, so it sometimes reconnects and changes IP address, losing all its existing connections. When the connection fails while the git client is running, the client never succeeds but it doesn't fail with a timeout either, so my script hangs up.

我想设置客户端,使其在一段时间后超时(以便脚本可以重试,记录失败或执行任何其他操作).但是我在git-config手册页中没有找到任何超时选项.我发现了相关问题,但这仅用于SSH连接.您知道HTTP服务器是否有替代方法吗?

I'd like to set up the client so it timeouts after some period (so the script can retry, or log a failure, or take any other action). But I didn't find any timeout option in the git-config manpage. I found a related question but it's only for SSH connections. Do you know if there's an alternative for http servers?

推荐答案

您可以尝试使用

http.lowSpeedLimit,http.lowSpeedTime

http.lowSpeedLimit, http.lowSpeedTime

如果HTTP传输速度较慢 比http.lowSpeedLimit更长的时间 超过http.lowSpeedTime秒, 传输中止.可以被覆盖 通过GIT_HTTP_LOW_SPEED_LIMIT和 GIT_HTTP_LOW_SPEED_TIME环境 变量.

If the HTTP transfer speed 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.

这篇关于有没有办法使git超过http超时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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