[英]git@github.com: Permission denied (publickey) from public repository
I can not clone repositories from github even if there are public:我无法从 github 克隆存储库,即使有公共存储库:
git clone https://github.com/github/fetch.git
Cloning into 'fetch'...
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.
Everything works if I want to clone from eg bitbucket.如果我想从 bitbucket 克隆,一切正常。
You wrote clone command with https://
URL but Git started to clone with git@
scp-like SSH URL. This means you have url.….insteadOf
section(s) in your Git configs that overwrite your URLs on the fly.您用
url.….insteadOf
https://
URL编写了克隆命令,但Git开始使用git@
SCP-Like SSH881657866602088。
Run跑步
git config --list --show-origin | grep -Fi insteadof
to find out where exactly is the problematic configuration and comment out or remove what you do not need now.找出有问题的配置的确切位置,然后注释掉或删除您现在不需要的配置。
Most probably you have a section like this in your global ~/.gitconfig
:很可能你在全局
~/.gitconfig
中有这样的部分:
[url "git@github.com:"]
insteadOf = https://github.com/
To remove it:要删除它:
git config --global --remove-section url.git@github.com:
Or use your editor to inspect and edit the file:或者使用您的编辑器检查和编辑文件:
git config --global --edit
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.