我创建了一个新的远程存储库并尝试使用git push -u origin master
命令将我的本地文件推送到新存储库后第一次add
it and commit
它。然而,它弹出这个[email protected] /cdn-cgi/l/email-protection: Permission denied (publickey). fatal: Could not read from remote repository.
。我该如何修复这个致命错误?
我试过这个
使用Git时如何解决权限被拒绝(publickey)错误? https://stackoverflow.com/questions/2643502/how-to-solve-permission-denied-publickey-error-when-using-git/42641637#42641637看来这个链接中的问题是第一次使用 git 时发生的。我已经使用 git 一段时间了,我还需要遵循这个解决方案吗?谁能给我一个更具体的解决方案?
这是我遇到的致命错误
C:\Users\ASUS\Desktop\React-Practice App\my-app>git status
On branch master
nothing to commit, working tree clean
C:\Users\ASUS\Desktop\React-Practice App\my-app>git push -u origin master
[email protected] /cdn-cgi/l/email-protection: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
您正在通过 SSH 访问 GitHub。首先生成SSH密钥对;然后将公钥添加到 GitHub。
生成密钥对,github更喜欢“Ed25519算法”
ssh-keygen -t ed25519 -C "[email protected] /cdn-cgi/l/email-protection"
它仍然允许在不支持 Ed25519 的系统上使用 rsa
ssh-keygen -t rsa -b 4096 -C “[email protected] /cdn-cgi/l/email-protection”
更多信息请访问https://help.github.com/en/articles/generate-a-new-ssh-key-and-adding-it-to-the-ssh-agent https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent and https://help.github.com/en/articles/adding-a-new-ssh-key-to-your-github-account https://help.github.com/en/articles/adding-a-new-ssh-key-to-your-github-account
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)