Skip to content

Update installation instructions for Linux #4634

Description

@jmooring

https://github.com/cli/cli/blob/trunk/docs/install_linux.md

The umask on my system results in new files with 600 permission. With this permission on /usr/share/keyrings/githubcli-archive-keyring.gpg, running sudo apt update fails:

W: GPG error: https://cli.github.com/packages stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY C99B11DEB97541F0
E: The repository 'https://cli.github.com/packages stable InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Recommend updating documentation to:

curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo chmod 644 /usr/share/keyrings/githubcli-archive-keyring.gpg
sudo chmod 644 /etc/apt/sources.list.d/github-cli.list
sudo apt update
sudo apt install gh

Activity

  1. added
    priority-3Affects a small number of users or is largely cosmetic
    on Oct 29, 2021
  2. bdombro commented on Dec 25, 2021

    @bdombro

    I still get the error, even with the updated snippet debian in windows+ws2

  3. orvisevans commented on Mar 2, 2022

    @orvisevans

    I was having this problem, but the issue was that curl wasn't installed. Then the official docs worked great for me.

  4. charltonstanley commented on Jul 8, 2022

    @charltonstanley

    for me the following worked.

    curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg --output /usr/share/keyrings/githubcli-archive-keyring.gpg
    sudo gpg --dearmor /usr/share/keyrings/githubcli-archive-keyring.gpg
    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
    sudo chmod 644 /usr/share/keyrings/githubcli-archive-keyring.gpg
    sudo chmod 644 /etc/apt/sources.list.d/github-cli.list
    sudo apt update
    sudo apt install gh
    

    sys info

    $ cat /etc/os-release
    
    NAME="Linux Mint"
    VERSION="20.3 (Una)"
    ID=linuxmint
    ID_LIKE=ubuntu
    PRETTY_NAME="Linux Mint 20.3"
    VERSION_ID="20.3"
    HOME_URL="https://www.linuxmint.com/"
    SUPPORT_URL="https://forums.linuxmint.com/"
    BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/"
    PRIVACY_POLICY_URL="https://www.linuxmint.com/"
    VERSION_CODENAME=una
    UBUNTU_CODENAME=focal
    
  5. LittleFreak commented on Jul 28, 2022

    @LittleFreak

    i have still the same error; tried both of your snippets though.
    I'm running debian 10 in wsl2, gpg is installed.

  6. LionsRepoVerse commented on Jul 30, 2022

    @LionsRepoVerse

    for me the following worked.

    curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg --output /usr/share/keyrings/githubcli-archive-keyring.gpg
    sudo gpg --dearmor /usr/share/keyrings/githubcli-archive-keyring.gpg
    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
    sudo chmod 644 /usr/share/keyrings/githubcli-archive-keyring.gpg
    sudo chmod 644 /etc/apt/sources.list.d/github-cli.list
    sudo apt update
    sudo apt install gh
    

    sys info

    $ cat /etc/os-release
    
    NAME="Linux Mint"
    VERSION="20.3 (Una)"
    ID=linuxmint
    ID_LIKE=ubuntu
    PRETTY_NAME="Linux Mint 20.3"
    VERSION_ID="20.3"
    HOME_URL="https://www.linuxmint.com/"
    SUPPORT_URL="https://forums.linuxmint.com/"
    BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/"
    PRIVACY_POLICY_URL="https://www.linuxmint.com/"
    VERSION_CODENAME=una
    UBUNTU_CODENAME=focal
    

    worked like a charm... thanks for the solution buddy..!

  7. anupam-io commented on Aug 25, 2022

    @anupam-io

    @orvisevans You can bold curl, as I missed that. :)

  8. danielbrai commented on Sep 8, 2022

    @danielbrai

    https://github.com/cli/cli/blob/trunk/docs/install_linux.md

    The umask on my system results in new files with 600 permission. With this permission on /usr/share/keyrings/githubcli-archive-keyring.gpg, running sudo apt update fails:

    W: GPG error: https://cli.github.com/packages stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY C99B11DEB97541F0
    E: The repository 'https://cli.github.com/packages stable InRelease' is not signed.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    

    Recommend updating documentation to:

    curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg
    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
    sudo chmod 644 /usr/share/keyrings/githubcli-archive-keyring.gpg
    sudo chmod 644 /etc/apt/sources.list.d/github-cli.list
    sudo apt update
    sudo apt install gh

    This solve my problem! Tnx

  9. RTGho commented on Sep 14, 2022

    @RTGho

    Worked for me as well. Many thanks!

  10. mislav commented on Sep 15, 2022

    @mislav
    Contributor

    This was fixed in #5844; forgot to close. Thanks everyone!

  11. KatiaGonGon commented on Sep 27, 2022

    @KatiaGonGon

    I was having this problem, but the issue was that curl wasn't installed. Then the official docs worked great for me.

    This was my problem too and the terminal didn't show "Command 'curl' not found". Ubuntu new releases don't provide curl command, instead you can download it, but this is not necessary. All you need is download the file githubcli-archive-keyring.gpg from: [https://cli.github.com/packages/githubcli-archive-keyring.gpg] or from a keyserver, and then move it to the directory /usr/share/keyrings/ This directory had an empty file with the same name (cause curl din't download anything). The "sources.list" is configured fine for this path so you should avoid change file name.
    I know the issue is closed but I wanted comment to try help anyone with this same issue (Google doesn't have much info and is plenty of deprecated solutions like the use of apt-key command). Sorry if this is not the proper manner I'm a little bit newbie github user.

  12. mislav commented on Sep 27, 2022

    @mislav
    Contributor

    @KatiaGonGon Thanks for the tip! We'll try to amend our installation documentation to account for the fact that curl might not be present on the system. I did not know that Ubuntu stopped shipping curl by default. 🙇

  13. Mllexx commented on Nov 1, 2022

    @Mllexx

    curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg --output /usr/share/keyrings/githubcli-archive-keyring.gpg
    sudo gpg --dearmor /usr/share/keyrings/githubcli-archive-keyring.gpg
    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
    sudo chmod 644 /usr/share/keyrings/githubcli-archive-keyring.gpg
    sudo chmod 644 /etc/apt/sources.list.d/github-cli.list
    sudo apt update
    sudo apt install gh

    this worked for me, thanks.

  14. Alyaa410 commented on Jul 23, 2024

    @Alyaa410

    (type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y))
    && sudo mkdir -p -m 755 /etc/apt/keyrings
    && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null
    && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg
    && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
    && sudo apt update
    && sudo apt install gh -y

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocspriority-3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions