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

  学习《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.



  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值