前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle解决版本

fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle解决版本

作者头像
叉叉敌
发布2019-09-18 15:51:01
3.4K0
发布2019-09-18 15:51:01
举报
文章被收录于专栏:ChasaysChasays

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

本文链接:https://blog.csdn.net/weixin_42514606/article/details/100927076

现象

fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle fatal: error Errno 110 Connection timed out

根本原因

repo工具是一个python脚本,里面有个方法_InitHttp,检测到http_proxy在环境变量中就会用他,如果环境变量是一个无效的,那么就会报错。所以要么时候一个有效的,或者就没有这个环境变量。

代码语言:javascript
复制
def _InitHttp():
  handlers = []

  mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
  try:
    import netrc
    n = netrc.netrc()
    for host in n.hosts:
      p = n.hosts[host]
      mgr.add_password(p[1], 'http://%s/' % host, p[0], p[2])
      mgr.add_password(p[1], 'https://%s/' % host, p[0], p[2])
  except:
    pass
  handlers.append(urllib.request.HTTPBasicAuthHandler(mgr))
  handlers.append(urllib.request.HTTPDigestAuthHandler(mgr))

  if 'http_proxy' in os.environ:
    url = os.environ['http_proxy']
    handlers.append(urllib.request.ProxyHandler({'http': url, 'https': url}))
  if 'REPO_CURL_VERBOSE' in os.environ:
    handlers.append(urllib.request.HTTPHandler(debuglevel=1))
    handlers.append(urllib.request.HTTPSHandler(debuglevel=1))
  urllib.request.install_opener(urllib.request.build_opener(*handlers))

解决方法

  1. 如果是本地需要代理,就设置一个代理
代码语言:javascript
复制
set http_proxy=http://user:pass@host:port
set https_proxy=https://user:pass@host:port
  1. 不需要代理就unset 代理即可
代码语言:javascript
复制
unset https_proxy
unset http_proxy
  1. 永久的移除或者添加一个代理
代码语言:javascript
复制
cat /etc/enviroment

我还分享在这里了 https://stackoverflow.com/questions/38594080/fatal-cannot-get-https-gerrit-googlesource-com-git-repo-clone-bundle-fatal-e/57968927#57968927

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019年09月17日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 现象
  • 根本原因
  • 解决方法
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档