git@github.com:执行 brew cask 安装时权限被拒绝(公钥)"program"
git@github.com: Permission denied (publickey) when doing a brew cask install "program"
每当我尝试进行 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>'
答案在我的 .gitconfig 文件中。
必须注释掉这一行:
# insteadOf = https://github.com/```
OP 提供的解决方案当然是一个有效的解决方法,但对于更多上下文,导致此行为的完整 Git 配置可能如下所示:
[url "git@github.com:"]
insteadOf = https://github.com/
这会强制通过 HTTPS 发出的任何 GitHub 请求改为使用 SSH。 git@github.com: Permission denied (publickey)
通知表明您未设置为通过 GitHub 使用 SSH。
一些额外的 background/discussion:
GitHub docs on Authenticating with GitHub from Git推荐通过 HTTPS 连接,所以如果你不介意的话,你可以删除原来的配置行。
如果您希望始终通过 SSH 连接,可以保持配置不变,并按照 Connecting to GitHub with SSH.
上的说明进行操作
每当我尝试进行 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>'
答案在我的 .gitconfig 文件中。
必须注释掉这一行:
# insteadOf = https://github.com/```
OP 提供的解决方案当然是一个有效的解决方法,但对于更多上下文,导致此行为的完整 Git 配置可能如下所示:
[url "git@github.com:"]
insteadOf = https://github.com/
这会强制通过 HTTPS 发出的任何 GitHub 请求改为使用 SSH。 git@github.com: Permission denied (publickey)
通知表明您未设置为通过 GitHub 使用 SSH。
一些额外的 background/discussion:
GitHub docs on Authenticating with GitHub from Git推荐通过 HTTPS 连接,所以如果你不介意的话,你可以删除原来的配置行。
如果您希望始终通过 SSH 连接,可以保持配置不变,并按照 Connecting to GitHub with SSH.
上的说明进行操作