在本地写完代码,同步到github上时,报错:
root@tegra-ubuntu:/home/ubuntu/pathplan/pathPlan-test#
root@tegra-ubuntu:/home/ubuntu/pathplan/pathPlan-test# git push origin master
The authenticity of host 'github.com (192.30.255.112)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)?
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
root@tegra-ubuntu:/home/ubuntu/pathplan/pathPlan-test#
怀疑应该时ssh传数据验证失败。试了一下吧origin删了,重新生成一边:
(查看远程仓库命令:git remote -v)
删除远程仓库命令:git remote rm origin
添加远程仓库命令:git remote add origin2 https://github.com/MercyMM/RT-Path-Planning-and-Reconstruction
重新生成后再git push还是上面哪个错误。
于是重新生成一边ssh密钥:ssh-keygen -t rsa -C "e-mail@xx.com"
生成过程中需要输入密钥保存地址,默认地址是:“ Enter file in which to save the key (/root/.ssh/id_rsa):”。
这时候反应过来了。原来我用的root用户,它找密钥的时候找的是/root/.ssh/。我之前的密钥是存在/home/ubuntu/.ssh/目录下的。遂将用户切换成ubuntu,然后再git push,变成功了。
这里我生成密钥的时候把/home/ubunt/下的密钥覆盖了,所以我有把新的公钥放到github里。
这里有个小问题。我之前写的代码commit后,时间记录的是2017年。但是后面由于没插网线,再commit时时间是2000年
然后push到github上后,
它竟然是安装时间排序,而不是逻辑先后排序。这个不知道会不会造成什么隐患。。。