所以我最近不得不重新安装我的操作系统,这意味着ssh-keygen。登录到git后,它显示我的新密钥已经过身份验证,但我无法克隆任何内容。
事实:
我使用的是基本操作系统,它是Ubuntu的味道。
我可以成功git init
并创建在我的git admin / settings
第1步。
sudo git clone git@github.com:angular/angular.js.git
:/opt/lampp/htdocs/Angles$ sudo git clone git@github.com:angular/angular.js.git
Cloning into 'angular.js'...
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
第2步。
ssh -T git@github.com
Hi USERNAME! You've successfully authenticated, but GitHub does not provide shell access.
步骤3.(尝试身份验证)
m@Fido-desktop:/opt/lampp/htdocs/Angles$ eval "$(ssh-agent -s)"
Agent pid 8924
m@Fido-desktop:/opt/lampp/htdocs/Angles$ sudo ssh-add -l
Could not open a connection to your authentication agent.
m@Fido-desktop:/opt/lampp/htdocs/Angles$ ssh-add -l
The agent has no identities.
m@Fido-desktop:/opt/lampp/htdocs/Angles$ eval "$(ssh-agent -s)"
Agent pid 9081
m@Fido-desktop:/opt/lampp/htdocs/Angles$ ssh-add-l
The agent has no identities.
步骤4.(Ubuntu解决方案?)
m@Fido-desktop:/opt/lampp/htdocs/Angles$ ssh -T git@github.com
Hi USERNAME! You've successfully authenticated, but GitHub does not provide shell access.
m@Fido-desktop:/opt/lampp/htdocs/Angles$ eval 'ssh-agent -s'
SSH_AUTH_SOCK=/tmp/ssh-kehosjF10336/agent.10336; export SSH_AUTH_SOCK;
SSH_AGENT_PID=10337; export SSH_AGENT_PID;
echo Agent pid 10337;
m@Fido-desktop:/opt/lampp/htdocs/Angles$ ssh-add -l
2048 MY:SE:CU:RE:KE:Y0 /home/m/.ssh/id_rsa (RSA)
m@Fido-desktop:/opt/lampp/htdocs/Angles$ sudo git clone git@github.com:angular/angular.js.git
[sudo] password for m:
Cloning into 'angular.js'...
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
m@Fido-desktop:/opt/lampp/htdocs/Angles$
答案 0 :(得分:2)
sudo git clone
不会使用与ssh -T git@github.com
相同的密钥。
/root/.ssh
/home/myAccount/.ssh
只是不要使用sudo
来克隆。