美文网首页程序员
Permission to xxx denied to othe

Permission to xxx denied to othe

作者: _Charles | 来源:发表于2018-01-08 19:24 被阅读0次

这是因为你没有权限

解决方案

1.生成一对新的SSH KEY

cd ~/.ssh

ssh-keygen -t rsa -C "邮箱地址"

然后会提示你输入文件名和密码,文件一般会这么写:id_rsa_personal,personal 部分区你容易记忆的

然后.ssh目录下就会多出来两个文件(一对RSA),私匙(id_rsapersonal),公匙(id_rsapersonal.pub)

2.将公匙文件里面的内容添加到 git 账号下

github登录

头像下 settings

选择 SSH and GPG keys

选择 New SSH key

key中黏贴(title 随便)

3.配置 config 文件

eg:

#Default GitHub
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa

Host github-personal
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_personal

这里 Host 和 IdentityFile 需要做些修改

Host 与远程服务器的 Host 对应

eg:

git@github-personal:tom/index.git
github-personal.com:tom/index.git

IdentityFile就是私钥

4.修改 origin

到 clone 文件夹下修改 origin 为 A 或 B

A: git@github-personal:tom/index.git
B: github-personal.com:tom/index.git

5.连接下试试

ssh -T github-personal

得到下面提示说明设置成功了

Hi tom You've successfully authenticated, but GitHub does not provide shell access.

github账户如果还是显示之前id_rsa密钥账户的话请把你的密钥加入sshAgent代理中

ssh-add id_rsa_personal

相关文章

网友评论

    本文标题:Permission to xxx denied to othe

    本文链接:https://www.haomeiwen.com/subject/ejxinxtx.html