由于更换电脑,直接把mac下的.ssh 目录拷贝在centos下,一直出现:
Permission to userA/repo.git denied to userB
在网上查找了许多方法都没有解决,
首先第一步,删除userB的rsa & rsa.pub ,再次提交:
no such identity: /Users/sunkaixiang/.ssh/id_rsa2: No such file or directory
原来没有修改ssh/cofig的配置路径,
Host nick
HostName github.com
User git
IdentityFile /home/**/.ssh/id_rsa2
之后出现了一个错误:
Agent admitted failure to sign using the key.
使用 ssh-add 指令将私钥 加进来
ssh-add ~/.ssh/id_rsa2
提交成功.
查看你的Git全局设置信息
git config -l
参考:https://blog.youkuaiyun.com/klxh2009/article/details/76019742
https://www.cnblogs.com/dlutxm/archive/2011/10/14/2212019.html