今天用git clone 命令clone服务器上的代码时候报了如下的错误:
ouyangpeng@oyp-ubuntu:~/Android/git_canplay_code$ git clone gitcply:canplay/vendor/mstar/Canplay/apps/Video Cloning into 'Video'... Agent admitted failure to sign using the key. git@192.168.1.118's password: Permission denied, please try again.
没法clone代码下来我开始还以为是我密码忘记了,然后又重新使用ssh-keygen -t rsa命令,在.ssh文件夹下生成了2个文件,一个公钥文件id_rsa.pub 和一个私钥文件 id_rsa ,然后将公钥文件发给管理员,并让管理员将我的相关配置更改一下,结果还是无法下载,没办法只能百度寻求解决之道。终于在下面这篇文章中找到了解决方法。
http://www.cnblogs.com/dlutxm/archive/2011/10/14/2212019.html
使用 ssh-add 指令将私钥 加进来 (根据个人的密匙命名不同更改 id_rsa)
ouyangpeng@oyp-ubuntu:~/Android/git_canplay_code$ ssh-add ~/.ssh/id_rsa Enter passphrase for /home/ouyangpeng/.ssh/id_rsa: Identity added: /home/ouyangpeng/.ssh/id_rsa (/home/ouyangpeng/.ssh/id_rsa)
然后在clone就可以了
ouyangpeng@oyp-ubuntu:~/Android/git_canplay_code$ git clone gitcply:canplay/vendor/mstar/Canplay/apps/Video Cloning into 'Video'... remote: Counting objects: 305, done. remote: Compressing objects: 100% (159/159), done. remote: Total 305 (delta 135), reused 224 (delta 93) Receiving objects: 100% (305/305), 220.15 KiB, done. Resolving deltas: 100% (135/135), done.
====================================================================================
作者:欧阳鹏 欢迎转载,与人分享是进步的源泉!
转载请保留原文地址:http://blog.csdn.net/ouyang_peng
===================================================================================