ZBLOG

PS D:\webrtc\windows\webrtc\webrtc\webrtc-checkout\src> gclient runhooks fatal: unable to access 'https://chromium.googlesource.com/chromium/tools/depot_tools.git/': Failed to connect to chromium.googlesource.com port 443: Timed out

这个错误表明 gclient runhooks 命令无法连接到 Chromium 的代码仓库服务器(chromium.googlesource.com),通常是由于网络连接问题导致的。以下是逐步解决方案:


1. 检查网络连接

首先确认你的网络可以正常访问 Google 服务:

ping chromium.googlesource.com

如果超时,可能是由于网络限制代理问题


2. 配置 Git HTTP/HTTPS 代理

如果你在公司内网或需要代理才能访问外网,请设置 Git 的代理:

(A) 使用 HTTP/HTTPS 代理

git config --global http.proxy http://<proxy_ip>:<port>
git config --global https.proxy https://<proxy_ip>:<port>

例如(Clash/V2Ray/Nginx 等常用代理):

git config --global http.proxy http://127.0.0.1:7890
git config --global https.proxy https://127.0.0.1:7890

(B) 使用 SOCKS5 代理(如 Shadowsocks)

git config --global http.proxy socks5://127.0.0.1:10808
git config --global https.proxy socks5://127.0.0.1:10808

⚠️ 注意:如果不需要代理了,记得取消设置:

> git config --global --unset http.proxy  
> git config --global --unset https.proxy  
> ```

---

### **3. 尝试直接下载 `depot_tools`**
如果 `gclient runhooks` 仍然失败,可以手动下载 `depot_tools`:
1. **从官方镜像下载 ZIP**(适用于 Windows):
   - [https://storage.googleapis.com/chrome-infra/depot_tools.zip](https://storage.googleapis.com/chrome-infra/depot_tools.zip)
2. **解压到本地目录**(如 `D:\depot_tools`)
3. **添加至系统 PATH**:
   ```powershell
   $env:PATH += ";D:\depot_tools"
  1. 重新运行 gclient runhooks

4.(可选)修改 hosts / DNS

如果域名解析失败,可以尝试修改 hosts

  • Windows:编辑 C:\Windows\System32\drivers\etc\hosts
  • Linux/macOS:编辑 /etc/hosts 添加以下行:
172.217.*.* chromium.googlesource.com  
172.217.*.* googlesource.com  

(IP地址可能变化,建议用 ping chromium.googlesource.com 获取最新 IP)


5.(终极方案)使用国内镜像

如果你的网络环境受限,可以使用清华 TUNA/Gitee 镜像站同步代码(但 WebRTC 部分资源仍需从 Google 拉取)。


验证是否成功

运行以下命令测试是否能正常访问仓库:

git ls-remote https://chromium.googlesource.com/chromium/tools/depot_tools.git HEAD

如果返回 commit hash,说明连接成功。

然后重新执行:

gclient runhooks

📌 总结

问题原因 解决方案
🔸 Git HTTPS/SOCKS5 Proxy git config --global http(s).proxy <ip:port>
🔹 DNS/防火墙拦截 🅰️改 hosts 🅱️换DNS (8.8.8.8 /114dns)
🔸 depot_tools损坏 🅰️重装 depot_tools 🅱️手动下载 .zip

如果仍有问题,请提供更详细的错误日志!


内容由零声教学AI助手提供,问题来源于学员提问

本站部分文章来源于网络,版权归原作者所有,如有侵权请联系站长删除。
转载请注明出处:https://golang.0voice.com/?id=23274

分享:
扫描分享到社交APP
上一篇
下一篇
发表列表
游客 游客
此处应有掌声~
评论列表

还没有评论,快来说点什么吧~

联系我们

在线咨询: 点击这里给我发消息

微信号:3007537140

上班时间: 10:30-22:30

关注我们
x

注册

已经有帐号?