Ultimate solution to error reporting of sudo rosdep init of ROS

Error reporting solution for sudo rosdep init of ROS
when installing ROS, the sudo rosdep init command reports an error:

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.

In the process of installing ROS, I encountered the problem of sudo rosdep init reporting an error. I searched many tutorials and couldn’t solve it. Later, I referred to the tutorial at the end of the article and couldn’t deal with it. Later, I realized that the installation failed because the installation source corresponding to rosdep couldn’t be opened directly in China. Based on the principle that others will encounter their own problems, Stick to the search and finally find the corresponding source file in gitee (you can also search in chinacode). Therefore, refer to the tutorial at the end of the article. Only when the final file of the tutorial is modified, the original source file will be added to the link( https://raw.github.com/ros/rosdistro/master/ )Replace with the link in chinacode:( https://gitee.com/BlicNet/rosdistro/ )When you try to follow the tutorial again, The problem is solved and posted in memory.

1. If a version of other versions of ROS system has been installed before, delete the existing initialization file according to the prompt:

sudo rm /etc/ros/rosdep/sources.list.d/20-default.list

2. Add the content/ROS/rosdep/sources.list.d/20-default.list in the/etc directory again

cd /etc/ros/rosdep/sources.list.d
sudo gedit 20-default.list

On some computers, there may be an error that MKDIR cannot create the package… The problem occurs because there is no permission to open related files. You can use the Chmod command to obtain permission

sudo chmod 777 /etc
    re execute the above command, open the 20-default.list file, copy the following contents into it, and save

    # os-specific listings first
    yaml https://gitee.com/BlicNet/rosdistro/rosdep/osx-homebrew.yaml osx
    
    # generic
    yaml https://gitee.com/BlicNet/rosdistro/rosdep/base.yaml
    yaml https://gitee.com/BlicNet/rosdistro/rosdep/python.yaml
    yaml https://gitee.com/BlicNet/rosdistro/rosdep/ruby.yaml
    gbpdistro https://gitee.com/BlicNet/rosdistro/releases/fuerte.yaml fuerte
    
    # newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
    

    4. Open the terminal on the desktop and execute the command:

    rosdep update
    

    Solve the problem and keep working hard!

    Reference link

    Link: https://blog.csdn.net/qq_ 41058594/article/details/102970901.
    link: https://www.cnblogs.com/JuiceCat/p/12000953.html.

Read More: