每当我尝试执行git克隆或brew安装时,都会出现以下错误:
不知道是什么问题,我用的是ohmysh
==> Tapping homebrew/cask
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask'...
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.
Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-cask /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask` exited with 128.
Follow the instructions here:
https://github.com/Homebrew/homebrew-cask#reporting-bugs
/usr/local/Homebrew/Library/Homebrew/utils.rb:266:in `safe_system'
/usr/local/Homebrew/Library/Homebrew/tap.rb:273:in `install'
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:157:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:123:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:9:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:103:in `<main>'发布于 2020-05-26 22:33:23
答案在我的.gitconfig文件中。
不得不评论一下这句话:
# insteadOf = https://github.com/```发布于 2020-10-18 01:58:14
OP提供的解决方案当然是一个有效的解决方案,但对于更多的上下文,导致此行为的完整Git配置可能如下所示:
[url "git@github.com:"]
insteadOf = https://github.com/这会迫使在HTTPS上发出的任何GitHub请求都使用SSH。git@github.com: Permission denied (publickey)通知指出,您没有通过GitHub设置使用SSH。
关于一些额外的背景/讨论:
关于从Git使用GitHub进行GitHub身份验证的文档建议通过HTTPS进行连接,因此如果您对此很满意,可以删除原来的配置行。
如果您希望始终通过SSH进行连接,则可以保持配置原样,并按照用SSH连接到GitHub上的说明进行操作。
https://stackoverflow.com/questions/61859367
复制相似问题