git - 权限被拒绝(公钥)&请确保您具有正确的访问权限并且存储库存在
问题描述
我尝试使用命令创建新存储库,但出现以下错误,我该如何解决?`我的窗口是 windows-7 pro
PS C:\Users\Naing Min Zaw\Desktop\learningGit> git push -u origin main
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.
我在powershell中使用这个命令
git init
git add .
git commit -m "first commit"
git branch -M main
git remote add origin git@github.com:NaingMinZaw/learningGit.git
git push -u origin main
解决方案
检查输出
git -c "core.sshCommand='ssh -Tv'" push -u origin main
这将显示在推送期间 SSH 查找了哪个 SSH 密钥。
如果您没有 SSH 密钥,请生成一个并将公钥添加到您的GitHub 配置文件中。
推荐阅读
- html - 如何交叉检查html中的提示输入
- javascript - 为什么不同架构下 Javascript 的字节码(v8 引擎)生成不同
- unity3d - 斜坡上的树干漂浮在统一地形上
- go - GOPATH入口是相对的,必须是绝对路径,怎么解决
- python - VS Code 中 django 的 Virtualenv 不起作用,我做错了什么?
- javascript - 条形图y轴中的酒窝js多个值类型
- docker - Gitlab CI 挂在 npm run build 上(webpack 生产命令)
- c++ - 自底向上归并排序的实现
- vhdl - 这是编写 VHDL 异步复位的有效方法吗?
- eslint - Sublime Text 4 - 如何设置 LSP-eslint