【发布时间】:2019-12-22 01:30:50
【问题描述】:
问题总结:
我正在尝试推送到 Github 上的远程存储库,但它给了我这个错误:
Warning: Permanently added the RSA host key for IP address
'192.30.253.112' to the list of known hosts.
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.
我所做的背景:
我像往常一样通过获取 Github 上显示的 url 添加了一个远程仓库。我输入的命令是:
git remote add origin https://github.com/bowtie/myremote.git
然后我通过输入git remote -v 检查了我的远程存储库,即使我添加了一个https url,它也会显示在它们前面带有“ssh”的url:
git remote -v
origin ssh://git@github.com/bowtie/myremote.git (fetch)
origin ssh://git@github.com/bowtie/myremote.git (push)
然后我无论如何都尝试推送,此时它给了我我提到的错误:
git push --set-upstream origin master
Warning: Permanently added the RSA host key for IP address '192.30.253.112'
to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
为什么即使我将 url 添加为 https,它仍然显示 ssh?我尝试使用 git remote set-url 更改它,没有任何改变。我完全删除了 URL,然后读取了它,它仍然向其中添加了“ssh”。我检查了 git 配置文件,并且 URL 中正确写入了 https,那为什么它在命令行上显示 ssh?
顺便说一句,我有另一个遥控器,当我遇到这个问题时,我从本地 repo 中删除了 .git 文件并重新初始化它,然后创建了另一个遥控器,认为问题可能出在遥控器上。但问题仍然存在。我之前曾尝试从 https 更改为 ssh,但我无法获取密钥。现在,我只想让 git bash 在没有 ssh:// 的情况下向我显示正确的 URL 并推送我的提交。
【问题讨论】:
-
您能否编辑您的问题以包含
git config -l | grep insteadof的输出?
标签: github ssh https rsa public-key