Sunday, March 31, 2024

Resolving "gh: command not discovered" or "gh will not be acknowledged" Errors

Must read


Introduction

Working right into a “gh: command not discovered” or “gh will not be acknowledged” error message might be irritating. This usually happens when the GitHub CLI (gh) will not be put in in your system or the trail to the executable will not be appropriately set.

On this Byte, we’ll stroll you thru the method of putting in GitHub CLI on Home windows and macOS utilizing totally different bundle managers.

There are lots of methods to do that between the assorted working techniques and bundle managers. I would recomment you take a look at the Desk of Contents on the correct to seek out your OS and most well-liked installer to extra simply discover what you want.

For every of the set up strategies under, as soon as the set up completes, you possibly can confirm that it put in appropriately by operating:

$ gh --version
gh model 1.14.0 (2021-04-19)

Set up GitHub CLI (gh) on Home windows by way of Chocolatey

Chocolatey is a bundle supervisor for Home windows. If you have not put in it but, you are able to do so by following the directions on the official Chocolatey web site. After getting Chocolatey put in, open your command immediate as an administrator and run the next command:

$ choco set up gh

Set up GitHub CLI (gh) on Home windows by way of Scoop

Scoop is one other bundle supervisor for Home windows. If you do not have Scoop put in, you possibly can observe the directions on the official Scoop web site to put in it. As soon as Scoop is put in, open your command immediate and run the next command:

$ scoop set up gh

Set up GitHub CLI (gh) on Home windows by way of WinGet

WinGet is a bundle supervisor that comes with Home windows 10. You may set up GitHub CLI utilizing WinGet by opening your command immediate as an administrator and operating the next command:

$ winget set up gh

Word: In case you are utilizing an older model of Home windows, WinGet is probably not out there. In that case, think about using Chocolatey or Scoop.

Set up GitHub CLI (gh) on macOS by way of Brew

Homebrew, also known as Brew, is a well-liked bundle supervisor for macOS. If you have not put in it but, you are able to do so by following the directions on the official Homebrew web site. After getting Brew put in, open your terminal and run the next command:

$ brew set up gh

Set up GitHub CLI (gh) on macOS by way of MacPorts

To put in the GitHub CLI (gh) on macOS utilizing MacPorts, you first want to make sure that you’ve got MacPorts put in in your system. If not, you possibly can set up it from the MacPorts web site. As soon as MacPorts is put in, you possibly can set up the GitHub CLI by operating the next command in your terminal:

$ sudo port set up gh

This command will obtain and set up the GitHub CLI in your system.

Set up GitHub CLI (gh) on macOS by way of Spack

Spack is one other bundle supervisor for macOS that you should utilize to put in the GitHub CLI. To put in Spack, observe the directions on the official Spack web site. After putting in Spack, you possibly can set up the GitHub CLI by operating:

$ spack set up gh

Set up GitHub CLI (gh) utilizing Anaconda

Anaconda is a well-liked Python distribution that features a bundle supervisor referred to as conda. You should utilize conda to put in the GitHub CLI. First, guarantee that you’ve Anaconda put in in your system. If not, obtain and set up it from the Anaconda web site. As soon as Anaconda is put in, open the Anaconda Immediate and run:

$ conda set up -c conda-forge gh

This command will set up the GitHub CLI.

Set up GitHub CLI (gh) on Debian, Ubuntu, Raspberry Pi OS

To put in the GitHub CLI on a Debian-based system like Debian, Ubuntu, or Raspberry Pi OS, you should utilize the apt bundle supervisor. First, replace your bundle lists by operating:

$ sudo apt replace

Then, set up the GitHub CLI by operating:

$ sudo apt set up gh

Set up GitHub CLI (gh) on Fedora, CentOS and Crimson Hat

On Fedora, CentOS, and Crimson Hat, you should utilize the dnf bundle supervisor to put in the GitHub CLI. First, replace your system by operating:

$ sudo dnf replace

Then, set up the GitHub CLI by operating:

$ sudo dnf set up gh

Word: The precise command to put in the GitHub CLI might range barely relying in your particular Linux distribution and model.

Set up GitHub CLI (gh) on Amazon Linux 2 (yum)

To put in GitHub CLI on Amazon Linux 2, we’ll use yum, which is the default bundle supervisor for this distribution. First, let’s replace the system packages utilizing the next command:

$ sudo yum replace -y

Subsequent, we have to obtain the GitHub CLI rpm bundle. You may at all times discover the newest model on the GitHub CLI releases web page. As of scripting this information, the newest model is 1.14.0. Change the model within the command under if a more recent model is out there:

$ wget https://github.com/cli/cli/releases/obtain/v1.14.0/gh_1.14.0_linux_amd64.rpm

Then, set up the downloaded bundle utilizing yum:

$ sudo yum localinstall gh_1.14.0_linux_amd64.rpm

Set up GitHub CLI (gh) on openSUSE/SUSE Linux with zypper

For openSUSE/SUSE Linux, we’ll use zypper to put in GitHub CLI. Begin by updating your system packages:

$ sudo zypper refresh

Subsequent, add the GitHub CLI repository to your system:

$ sudo zypper addrepo https://cli.github.com/packages/rpm/gh-cli.repo

Now, you possibly can set up gh utilizing zypper:

$ sudo zypper set up gh

Word: Remember to substitute 1.14.0 with the newest model out there on the time of your set up.

Conclusion

On this information, we have lined the right way to set up the GitHub CLI on fairly a number of working techniques / distros and bundle managers, like Home windows, macOS, Debian and brew, port, choco, yum, and so forth. With these steps, you must have the ability to repair the “gh: command not discovered” or “gh will not be acknowledged” errors. Bear in mind to at all times confirm your installations by checking the model of your put in packages.



Supply hyperlink

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article