ROS wstool-----无法从github下载源码解决

本文介绍了解决从GitHub下载源码时出现的SSH连接错误的方法。通过检查并配置SSH密钥,确保了远程仓库的正常访问。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  学习《Learning ROS for Robotics Programming - Second Edition》 时候从github下载源码报如下错误,后来发现是SSH key没有配置导致的问题。

wstool up -j8

error log如下:

[ros_book] Fetching git@github.com:AaronMR/Learning_ROS_for_Robotics_Programming_2nd_edition.git (version None) to /home/dev/lrrp_2nd_ws/src/ros_book
Cloning into '/home/dev/lrrp_2nd_ws/src/ros_book'...
The authenticity of host 'github.com (192.30.253.113)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.113' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Exception caught during install: Error processing 'ros_book' : [ros_book] Checkout of git@github.com:AaronMR/Learning_ROS_for_Robotics_Programming_2nd_edition.git version None into /home/dev/lrrp_2nd_ws/src/ros_book failed.

ERROR in config: Error processing 'ros_book' : [ros_book] Checkout of git@github.com:AaronMR/Learning_ROS_for_Robotics_Programming_2nd_edition.git version None into /home/dev/lrrp_2nd_ws/src/ros_book failed.


配置SSH key大致过程如下:

1)Check that you are connecting to the correct server

ssh -vT git@github.com
OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /Users/you/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug1: Connecting to github.com [192.30.252.131] port 22.

如果输出如下“-1”,表示找不到文件,

ssh -vT git@github.com
...
debug1: identity file /Users/you/.ssh/id_rsa type -1
debug1: identity file /Users/you/.ssh/id_rsa-cert type -1
debug1: identity file /Users/you/.ssh/id_dsa type -1
debug1: identity file /Users/you/.ssh/id_dsa-cert type -1
...
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/you/.ssh/id_rsa
debug1: Trying private key: /Users/you/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).

如果没有那么创建新的SSH key即可。

2)Generating a new SSH key

  1. Open Terminal.

  2. Paste the text below, substituting in your GitHub email address.

    ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
    

    This creates a new ssh key, using the provided email as a label.

    Generating public/private rsa key pair.
    
  3. When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.

    Enter a file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
    
  4. At the prompt, type a secure passphrase. For more information, see "Working with SSH key passphrases".

    Enter passphrase (empty for no passphrase): [Type a passphrase]
    Enter same passphrase again: [Type passphrase again]
    

3)Adding your SSH key to the ssh-agent

  1. Ensure ssh-agent is enabled:

    # start the ssh-agent in the background
    eval "$(ssh-agent -s)"
    Agent pid 59566
    
  2. Add your SSH key to the ssh-agent. If you used an existing SSH key rather than generating a new SSH key, you'll need to replace id_rsa in the command with the name of your existing private key file.

    $ ssh-add ~/.ssh/id_rsa
    
4)Adding a new SSH key to your GitHub account

  1. Copy the SSH key to your clipboard.

    If your SSH key file has a different name than the example code, modify the filename to match your current setup. When copying your key, don't add any newlines or whitespace.

    $ sudo apt-get install xclip
    # Downloads and installs xclip. If you don't have `apt-get`, you might need to use another installer (like `yum`)
    
    $ xclip -sel clip < ~/.ssh/id_rsa.pub
    # Copies the contents of the id_rsa.pub file to your clipboard
    

    Tip: If xclip isn't working, you can locate the hidden .ssh folder, open the file in your favorite text editor, and copy it to your clipboard.

  2. Settings icon in the user barIn the top right corner of any page, click your profile photo, then click Settings.

  3. Authentication keysIn the user settings sidebar, click SSH and GPG keys.

  4. SSH Key buttonClick New SSH key or Add SSH key.

  5. In the "Title" field, add a descriptive label for the new key. For example, if you're using a personal Mac, you might call this key "Personal MacBook Air".
  6. The key fieldPaste your key into the "Key" field.
  7. The Add key buttonClick Add SSH key.
  8. Sudo Mode DialogIf prompted, confirm your GitHub password.



### 如何使用 ZED 相机和 ROS 进行录制 为了成功使用 ZED 相机与 ROS 录制视频,需遵循特定的配置流程。确保已安装 `zed-ros-wrapper` 并设置好环境变量。 #### 安装依赖项 首先,在 Ubuntu 20.04 上准备开发环境: ```bash sudo apt-get update && sudo apt-get install ros-noetic-catkin python3-wstool ros-noetic-image-common ros-noetic-vision-opencv ros-noetic-cv-bridge ``` #### 获取并编译源码 接着获取官方支持库,并将其集成到工作空间中: ```bash cd catkin_ws/src/ git clone https://github.com/stereolabs/zed-ros-interfaces.git cd .. catkin_make -DCMAKE_BUILD_TYPE=Release source devel/setup.bash roslaunch zed_wrapper zed.launch camera_model:=ZED_mini ``` 上述命令用于初始化项目结构、下载必要的资源以及构建整个工程[^1]。 #### 配置录制参数 当启动节点后,可以开始配置要记录的数据流。对于双目图像和其他传感器信息而言,推荐至少订阅如下主题: ```plaintext /zed/zed_node/left/image_rect_color /zed/zed_node/right/image_rect_color /zed/zed_node/depth/depth_registered /zed/zed_node/rgb/camera_info /tf /tf_static /zed_node/odom /zed_node/pose ``` 这些路径涵盖了彩色图、深度图及相关变换矩阵等内容[^5]。 #### 开始录制过程 准备好之后就可以执行实际的录制操作了。打开一个新的终端窗口输入以下指令来创建目标文件夹并运行录制工具: ```bash mkdir -p ~/savebag cd ~/savebag rosbag record -O $(date +%Y%m%d_%H%M%S).bag \ /zed/zed_node/left/image_rect_color \ /zed/zed_node/right/image_rect_color \ /zed/zed_node/depth/depth_registered \ /zed/zed_node/rgb/camera_info \ /tf \ /tf_static \ /zed_node/odom \ /zed_node/pose ``` 此脚本会在指定位置生成一个带有时间戳标记的新 bag 文件[^4]。 #### 结束录制 完成采集任务时按下组合键 `Ctrl+C` 即可停止进程。此时可以在 `/home/user/savebag` 下找到刚产生的数据集。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值