ros 安装遇到 raw.githubusercontent.com无法访问,被墙的问题,尝试有效解决方案

这篇博客讲述了在Ubuntu环境中遇到rosdep初始化时下载默认源列表失败的问题,通过编辑hosts文件添加raw.githubusercontent.com的IP地址来解决。解决后成功执行rosdepinit和rosdepupdate,完成了ROS依赖项的更新。

问题:

gb@gb-VirtualBox:~$ sudo rosdep init
[sudo] gb 的密码:
ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.

 

解决方法

sudo vim /etc/hosts

增加:

151.101.76.133    raw.githubusercontent.com

重新开启终端尝试

gb@gb-VirtualBox:~$ sudo rosdep init
[sudo] gb 的密码:
Wrote /etc/ros/rosdep/sources.list.d/20-default.list
Recommended: please run

    rosdep update

gb@gb-VirtualBox:~$ rosdep update
reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
Skip end-of-life distro "ardent"
Skip end-of-life distro "bouncy"
Skip end-of-life distro "crystal"
Add distro "dashing"
Add distro "eloquent"
Add distro "foxy"
Skip end-of-life distro "groovy"
Skip end-of-life distro "hydro"
Skip end-of-life distro "indigo"
Skip end-of-life distro "jade"
Add distro "kinetic"
Skip end-of-life distro "lunar"
Add distro "melodic"
Add distro "noetic"
Add distro "rolling"
updated cache in /home/gb/.ros/rosdep/sources.cache
gb@gb-VirtualBox:~$

 

lhb@lhb-desktop:~/ros2_ws$ # 创建并进入工作空间 mkdir -p ~/ros2_ws/src cd ~/ros2_ws/ # 克隆 MAVROS 仓库 git clone https://github.com/mavlink/mavros.git -b ros2 src/mavros # 下载 mavros.yaml 文件 wget https://raw.githubusercontent.com/mavlink/mavros/ros2/mavros/mavros.yaml # 导入依赖项 vcs import src < mavros.yaml source ~/ros2_ws/install/setup.bashrallel-workers 4 fatal: 目标路径 'src/mavros' 已经存在,并且不是一个空目录。 --2025-05-30 15:49:22-- https://raw.githubusercontent.com/mavlink/mavros/ros2/mavros/mavros.yaml 正在解析主机 raw.githubusercontent.com (raw.githubusercontent.com)... 2606:50c0:8001::154, 2606:50c0:8000::154, 2606:50c0:8003::154, ... 正在连接 raw.githubusercontent.com (raw.githubusercontent.com)|2606:50c0:8001::154|:443... 已连接。 已发出 HTTP 请求,正在等待回应... 404 Not Found 2025-05-30 15:49:24 错误 404:Not Found。 bash: mavros.yaml: 没有那个文件或目录 正在读取软件包列表... 完成 正在分析软件包的依赖关系树... 完成 正在读取状态信息... 完成 python3-rosdep 已经是最新版 (0.25.1-1)。 升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 244 个软件包未被升级。 Wrote /etc/ros/rosdep/sources.list.d/20-default.list Recommended: please run rosdep update reading in sources list data from /etc/ros/rosdep/sources.list.d Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
最新发布
06-01
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值