【问题标题】:Install Heroku CLI on Mac showing exited with 128 error在 Mac 上安装 Heroku CLI,显示退出并出现 128 错误
【发布时间】:2022-01-15 18:59:02
【问题描述】:

我正在尝试使用此命令安装 Heroku CLI

brew tap heroku/brew && brew install heroku

但是我收到了这个错误

akshaybandivadekar@Akshays-MacBook-Pro ~ % brew tap heroku/brew && brew install heroku     

==> Tapping heroku/brew
Cloning into '/usr/local/Homebrew/Library/Taps/heroku/homebrew-brew'...
akshaybandivadekar@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/heroku/homebrew-brew /usr/local/Homebrew/Library/Taps/heroku/homebrew-brew --origin=origin --template=` exited with 128.

我检查了我的 GitHub 个人资料,我的 ssh 密钥设置在那里成功。 我可以使用 ssh 设置克隆任何公共仓库,例如

git clone git@github.com:lodash/lodash.git

但是这个命令不起作用

git clone https://github.com/lodash/lodash.git

我已经完成了本文中给出的所有命令 => https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

但仍然面临同样的问题。

【问题讨论】:

    标签: git macos github heroku


    【解决方案1】:

    首先,任何不使用 'git' 作为其远程用户的 SSH URL 都将不起作用。
    所以akshaybandivadekar@github.com不能用。

    第二个https://github.com/lodash/lodash.git 是 HTTPS URL,而不是 SSH URL。
    如果你想使用你的 SSH 私钥,你需要:

    git clone git@github.com:lodash/lodash.git
    

    如果你想强制使用 SSH:

    git config --global url."git@github.com:".insteadOf "https://github.com/"
    

    但您需要确保您有权访问该存储库。

    另外,如果 akshaybandivadekar@github.com 是依赖项的一部分:

    git config --global url."git@github.com:".insteadOf "akshaybandivadekar@github.com:"
    

    【讨论】:

    • 但是假设某些命令依赖于另一个 GitHub 存储库,那么这种情况下它使用 HTTPS URL 并且它会中断 =>brew tap heroku/brew && brew install heroku ==> 克隆到 ' /usr/local/Homebrew/Library/Taps/heroku/homebrew-brew'... akshaybandivadekar@github.com:权限被拒绝(公钥)。致命:无法从远程存储库中读取。请确保您具有正确的访问权限错误:执行时失败; git clone https://github.com/heroku/homebrew-brew /usr/local/Homebrew/Library/Taps/heroku/homebrew-brew --origin=origin --template= 以 128 退出
    • @AkshayBandivadekar 我已经编辑了我的答案以解决您的评论。首先尝试我在那里提到的最后一个命令。
    • 我已经尝试了最后一个命令,但仍然面临同样的问题
    • 但是我已经尝试了最后一个命令(git config --global url."git@github.com:".insteadOf "github.com" ),它有效,非常感谢@ VonC,你救了我的命,真的很感激 :)
    • @AkshayBandivadekar 太棒了!干得好!
    猜你喜欢
    • 1970-01-01
    • 2021-06-24
    • 2016-11-05
    • 1970-01-01
    • 2021-02-26
    • 2020-04-23
    • 1970-01-01
    • 1970-01-01
    • 2015-08-01
    相关资源
    最近更新 更多