我能想到的唯一相关的事情就是在~/.ssh/config中添加以下内容
host github.com
HostName github.com
IdentityFile /Users/miranda/.ssh/miranda_git
User git调试
mirandazhang@Mac$ ssh -T git@github.com
Hi miranda You've successfully authenticated, but GitHub does not provide shell access.
mirandazhang@Mac$ git push
git@gist.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.$ sudo git push很好,与克隆公共要点一样,它也需要sudo。
编辑
对我的密钥文件的权限:
-rw------- 1 mirandazhang miranda_zhang_q_git
-rw-r--r-- 1 mirandazhang miranda_zhang_q_git.pub发布于 2019-10-18 21:55:17
你的问题是你没有使用正确的钥匙。push remote使用gist.github.com,但SSH配置仅指github.com。SSH无法知道它们应该使用相同的凭据。
您可以为gist.github.com添加一个额外的节,也可以调整Host行以读取Host github.com gist.github.com,以便为GitHub上的Gist和非Gist内容使用正确的键。
https://stackoverflow.com/questions/58444712
复制相似问题