git:could not open a connection to your authentication agent

时间:2023-03-17 16:25:26

git:could not open a connection to your authentication agent

 

错误:

vagrant@homestead:~/Code/sample$ git push -u origin master

git@github.com: Permission denied (publickey).

 

fatal: Could not read from remote repository.

 

Please make sure you have the correct access rights

and the repository exists.

 

 

先执行  eval `ssh-agent`  

再执行 ssh-add ~/.ssh/rsa

 

上面有可能会找不到路径

 

vagrant@homestead:~/Code/sample$ ssh-add ~/.ssh/id_key

/home/vagrant/.ssh/id_key: No such file or directory

切换到秘钥目录在执行就行了

 

 

vagrant@homestead:~$ cd .ssh/

 

vagrant@homestead:~/.ssh$ ssh-add ~/.ssh/id_rsa

 

 

成功:Identity added: /home/vagrant/.ssh/id_rsa (/home/vagrant/.ssh/id_rsa)

 

 

 

文章来源:刘俊涛的博客

欢迎关注,有问题一起学习欢迎留言、评论。