繁体   English   中英

`gh cli` 失败`git@github.com: Permission denied (publickey)` 但`gh desktop` 没有问题

[英]`gh cli` fails `git@github.com: Permission denied (publickey)` but no problem with `gh desktop`

我有点惭愧地承认到目前为止我使用的是 github 桌面
我现在决定尝试使用按照文档安装的gh cli

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0
sudo apt-add-repository https://cli.github.com/packages
sudo apt update
sudo apt install gh

明显成功

$ which gh
/usr/bin/gh
$ gh --version
gh version 1.8.1 (2021-04-02)
https://github.com/cli/cli/releases/tag/v1.8.1

但要克隆一个公共仓库(例如flutter 画廊)运行gh repo clone flutter/gallery
我收到以下错误

Cloning into 'gallery'...
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.
exit status 128

(一切工作“开箱即用”与gh-desktop
我错过了什么?

github 讨论

首先检查您是否直接使用ssh有同样的问题:

ssh -T git@github.com

If that is the case, check your ~/.ssh content, and make sure you have added and then tested an SSH key in order for said key to work from command line (since GitHub Desktop might manage its own key internally to the GitHub Desktop应用)

因为即使克隆公共存储库也需要身份验证
运行gh auth login解决了这个问题
我打开了一个问题,提出了clearer authentication error message

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM