当前位置:   article > 正文

双系统 + Ubuntu20.04 + ros2 (foxy) git clone -b连接不成功的解决_ubuntu20.04 git使用不了

ubuntu20.04 git使用不了

一、问题描述

虚拟机已经跑通turtlebot3,能成功进行编译,进而执行自主避障,启动house地图,SLAM建图,SLAM导航等任务。但由于虚拟机加载gazebo模型太慢,且考虑到后面计划进行多机通讯,故配置双系统台式机进行仿真实验。

考虑到之前装的双系统是Ubunu22.04,但存在无法更新源的问题,且参考指导书版本是Ubuntu20.04+ROS2(foxy),为尽可能贴近故花了半小时重新装了系统…

系统安装完成后重新安装TB3功能包,下载过程中遇到以下报错,网页能访问Github但git clone无法成功连接。
在这里插入图片描述

二、问题解决

虽然这个问题解决了,但具原因出在哪里我还是未能明白/(ㄒoㄒ)/~~

1、晚上回寝看到网上有人说git clone失败可能是由于用的国外的源,可以换为清华或阿里的源试一试。Ubuntu系统中,软件源文件地址为:/etc/apt/sources.list

(1)备份原来的源,使用cp命令

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
  • 1

(2)修改/etc/apt/sources.list文件

sudo gedit /etc/apt/sources.list
  • 1

其中gedit可以换成你熟悉的编辑器(vim、nano、emacs…)
这里推荐清华、阿里软件源
阿里源
清华源
ubuntu20.04(focal)配置如下:

deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

# deb https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

找到对应的版本Ubuntu20.04,粘贴镜像到/etc/apt/sources.list,保存
在这里插入图片描述

(3)更新源
按Ctrl+Alt+T打开终端,更新源

sudo apt-get update
  • 1

如出现依赖问题,解决方式如下:

sudo apt-get -f install
  • 1

更新软件:

sudo apt-get upgrade
  • 1

后面再次进行git clone -b foxy-devel+网址,成功执行。
在这里插入图片描述
但要注意有时换源后还是很慢,有时会抽风时好时不好,如遇问题可多换几个网试一下,要耐心一点,多试几次。

下载完成后,进行编译的过程非常顺利。速度很快,没有报错。
在这里插入图片描述
在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/719159
推荐阅读
相关标签
  

闽ICP备14008679号