在操作 rosdep update 时 出现 访问 https://raw.githubusercontent.com/ 超时 导致 总是更新不成功,提示错误
ERROR: error loading sources list: The read operation timed out
如下图
这种情况 是因为 raw.githubusercontent.com 本身有多个ip,我们的DNS在解析 raw.githubusercontent.com 会解析到比较慢的 ip 上 导致 更新超时 ,如何解决呢?
国内 raw.githubusercontent.com 有以下ip:
185.199.108.133 raw.githubusercontent.com
185.199.109.133 raw.githubusercontent.com
185.199.110.133 raw.githubusercontent.com
185.199.111.133 raw.githubusercontent.com
那我们就可以在系统中 ping 一下每个 ip,选择最快的哪个放到 hosts 中,这样就可以每次解析到最快的那个ip
我这里最快的 ip 是 185.199.108.133 ,所以我就在 /etc/hosts 中增加一条记录
此时再使用 rosdep update 就很顺畅了,如果这个方法修改后,还不行,建议 换一个时间地点 再下载试试看