Search code examples
linuxgitubuntugithubgithub-cli

`gh cli` fails `[email protected]: Permission denied (publickey)` but no problem with `gh desktop`


I'm a bit ashamed to admit that so far I used github desktop
and I'm now determined to try using gh cli I installed following the documentation

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

with apparent success

$ 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

but to clone a public repo (for example flutter gallery) running gh repo clone flutter/gallery
I get the following error

Cloning into 'gallery'...
[email protected]: 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

(everithing worked "out-of-the-box" with gh-desktop)
what am I missing?

github discussion


Solution

  • as authentication is required even to clone a public repository
    running gh auth login fixes the issue
    I've open an issue proposing a clearer authentication error message