虚拟机上由于网络问题无法正常git clone
2026/6/10 9:26:49 网站建设 项目流程

命令:

git clone https://github.com/IFL-CAMP/easy_handeye.git #​(https://github.com/IFL-CAMP/easy_handeye.git 是官方的easy_handeye,手眼标定包,支持ROS Melodic)。 ​

报错“gnutls_handshake() failed: Error in the pull function

这是经典的网络连接问题

问题原因:你的系统Git使用GnuTLS库进行HTTPS连接,在某些网络环境(尤其是中国大陆)下与GitHub的TLS握手失败。

解决方案(从简单到彻底,按顺序试)

1.最简单:用GitHub镜像克隆(推荐,零配置)

用国内镜像(如ghproxy.com或github.com.cnpmjs.org)绕过直接连接:

git clone https://ghproxy.com/https://github.com/IFL-CAMP/easy_handeye.git

git clone https://github.com.cnpmjs.org/IFL-CAMP/easy_handeye.git
  • 成功后,仓库就在 ~/catkin_ws/src/easy_handeye。
  • 然后编译:
    cd ~/catkin_ws catkin_make source devel/setup.bash
2.如果你有代理/VPN(之前用过的)

配置Git全局代理(假设SOCKS5代理端口1080):

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

然后直接克隆原命令:

git clone https://github.com/IFL-CAMP/easy_handeye.git

用完取消:

git config --global --unset http.proxy git config --global --unset https.proxy
3.切换到SSH克隆(永久解决HTTPS问题)
  • 生成SSH密钥(如果没有):
    ssh-keygen -t ed25519 -C "your_email@example.com"
  • 复制公钥:
    cat ~/.ssh/id_ed25519.pub
  • 去GitHub设置 → SSH and GPG keys → New SSH key,粘贴公钥。
  • 测试:
    ssh -T git@github.com
    (看到“Hi username!”就成功)
  • 克隆:
    git clone git@github.com:IFL-CAMP/easy_handeye.git
4.如果以上都不行(极端情况)

手动下载ZIP:

  • 浏览器打开 https://github.com/IFL-CAMP/easy_handeye
  • 点击 Code → Download ZIP
  • 传到虚拟机,解压到 ~/catkin_ws/src/easy_handeye

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询