如何生成ssh key,以及repo init 遇到的无法检查签名:找不到公钥 问题

repo init 遇到 无法检查签名:找不到公钥 的问题

源文章: http://blog.csdn.net/njuitjf/article/details/38386941

方法一:

出现此问题是repo版本不对的问题,具体原因可网上搜索下,据说是google 代码传错导致。我更换过repo后,问题已经解决。curl http:///git-repo-downloads/repo ~/bin/repo


方法二:

也遇到了和楼主一样的问题。我的解决方案是,删除用户目录下的.repoconfig($ sudo rm -r ~/.repoconfig),再repo init,问题解决。
为什么会有这个问题,楼主可以看看自己下载的repo代码中是不是写道新建一个.repoconfig文件夹,用来保存一些签名版本信息。如果使用过其它来源的repo,签名信息在repo init时会与.repoconfig中内容不一致,就会报这个错。把这个文件夹删除,用电脑中当前的repo重新生成签名信息,就解决问题。


在做Syncing work tree的时候出错的
Fetching projects: 100% (204/224), done.
Syncing work tree: 90% (204/224) error: manifest required for thiscommand -- please run init

我打开.repo/project.list找到第204行,然后进入这个git的工作目录,发现这个git下只有一个.git文件夹,我把这个文件夹删掉后再做reposync就好了



如何生成SSH key



SSH key提供了一种与GitHub通信的方式,通过这种方式,能够在不输入密码的情况下,将GitHub作为自己的remote端服务器,进行版本控制



步骤

检查SSH keys是否存在

生成新的ssh key

将ssh key添加到GitHub中

如何生成SSH KEY



1. 检查SSH keys是否存在

输入下面的命令,如果有文件id_rsa.pub 或 id_dsa.pub,则直接进入步骤3将SSH key添加到GitHub中,否则进入第二步生成SSH key



ls -al ~/.ssh

# Lists the files in your .ssh directory, if they exist

2. 生成新的ssh key

第一步:生成public/private rsa key pair

在命令行中输入ssh-keygen -t rsa -C "your_email@example.com"



默认会在相应路径下(/your_home_path)生成id_rsa和id_rsa.pub两个文件,如下面代码所示



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

# Creates a new ssh key using the provided email

Generating public/private rsa key pair.

Enter file in which to save the key (/your_home_path/.ssh/id_rsa):

第二步:输入passphrase(本步骤可以跳过)



设置passphrase后,进行版本控制时,每次与GitHub通信都会要求输入passphrase,以避免某些“失误”



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

Enter same passphrase again: [Type passphrase again]

sample result:



Your identification has been saved in /your_home_path/.ssh/id_rsa.

Your public key has been saved in /your_home_path/.ssh/id_rsa.pub.

The key fingerprint is:

#01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com

第三步:将新生成的key添加到ssh-agent中:



# start the ssh-agent in the background

eval "$(ssh-agent -s)"

Agent pid 59566

ssh-add ~/.ssh/id_rsa

3. 将ssh key添加到GitHub中

用自己喜欢的文本编辑器打开id_rsa.pub文件,里面的信息即为SSH key,将这些信息复制到GitHub的Add SSH key页面即可



不同的操作系统,均有一些命令,直接将SSH key从文件拷贝到粘贴板中,如下:



mac



pbcopy < ~/.ssh/id_rsa.pub

# Copies the contents of the id_rsa.pub file to your clipboard

windows



clip < ~/.ssh/id_rsa.pub

# Copies the contents of the id_rsa.pub file to your clipboard

linux



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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值