Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

โ€œInvest in yourself โ€” your confidence is always worth it.โ€

Explore Cosmetic Hospitals

Start your journey today โ€” compare options in one place.

How to Install GitHub CLI (gh) on macOS, Windows, and Linux: Complete Step-by-Step Guide

SEO Title: How to Install GitHub CLI (gh) on Mac, Windows & Linux โ€“ 2026 Guide

Meta Description: Learn how to install GitHub CLI (gh) on macOS, Windows 10/11, Ubuntu, Debian, Fedora, RHEL, and CentOS. Includes commands, authentication, Git integration, updates, and troubleshooting.

Focus Keywords: GitHub CLI installation, install gh CLI, GitHub CLI Mac, GitHub CLI Windows, GitHub CLI Ubuntu, install gh Linux, GitHub CLI commands, gh auth login, GitHub CLI Homebrew


1. Introduction

GitHub is one of the most widely used platforms for hosting source code, managing pull requests, tracking issues, and automating software development workflows.

While most developers interact with GitHub through a web browser, GitHub also provides an official command-line tool called GitHub CLI (gh).

GitHub CLI brings GitHub functionality directly into your terminal, allowing you to manage repositories, pull requests, issues, releases, and workflows without repeatedly switching to a browser.

Whether you are a developer, DevOps engineer, system administrator, platform engineer, or automation specialist, learning GitHub CLI can significantly simplify everyday development tasks.

In this comprehensive tutorial, you will learn how to:

  • Install GitHub CLI on macOS, including Intel and Apple Silicon Macs.
  • Install GitHub CLI on Windows 10 and Windows 11.
  • Install GitHub CLI on Ubuntu and Debian.
  • Install GitHub CLI on Fedora, RHEL, and CentOS.
  • Install GitHub CLI on Amazon Linux and other Linux distributions.
  • Verify that the installation was successful.
  • Authenticate GitHub CLI with your GitHub account.
  • Configure Git to use GitHub CLI authentication.
  • Execute essential GitHub CLI commands.
  • Upgrade, troubleshoot, and uninstall GitHub CLI.

Let’s begin.

2. What Is GitHub CLI?

GitHub CLI is GitHub’s official open-source command-line tool.

Its executable is named:

gh

It allows users to manage GitHub resources from a terminal using simple commands.

For example, instead of visiting GitHub in your browser to review pull requests, you can execute:

gh pr listCode language: PHP (php)

To list repository issues:

gh issue listCode language: PHP (php)

To clone a GitHub repository:

gh repo clone OWNER/REPOSITORYCode language: PHP (php)

To check your authentication status:

gh auth status

Key Features of GitHub CLI

  • Authenticate with GitHub.com and supported GitHub Enterprise installations.
  • Create, view, review, and merge pull requests.
  • Create and manage GitHub issues.
  • Clone, fork, and manage repositories.
  • View GitHub Actions workflows and workflow runs.
  • Manage GitHub releases.
  • Access the GitHub REST and GraphQL APIs.
  • Integrate GitHub operations into scripts and automation.
  • Work with GitHub from macOS, Windows, and Linux terminals.

Git vs. GitHub CLI: What Is the Difference?

Git and GitHub CLI serve different purposes.

FeatureGitGitHub CLI (gh)
Primary purposeVersion controlGitHub platform management
Commandgitgh
Commit codeYesUses Git for normal version-control operations
Manage pull requestsNot directlyYes
Manage GitHub issuesNoYes
Clone repositoriesYesYes, through Git
Manage GitHub ActionsNoYes
Manage GitHub releasesNoYes
Access GitHub APINot directlyYes

Important: GitHub CLI does not replace Git. It complements Git by providing commands for GitHub-specific workflows.

For normal repository operations, install both Git and GitHub CLI.


3. Prerequisites

Before installing GitHub CLI, make sure your computer meets the following requirements.

RequirementDescription
Operating systemSupported macOS, Windows, or Linux
CPU architectureCompatible architecture such as x86-64 or ARM64
Internet connectionRequired to download packages and connect to GitHub
TerminalTerminal, Bash, Zsh, PowerShell, or Command Prompt
Package managerHomebrew, WinGet, APT, DNF, or another supported installer
GitHub accountRequired for authenticated GitHub operations
GitRecommended for repository operations

You can create a free GitHub account at:

https://github.com/signup

Check Whether Git Is Installed

On macOS or Linux:

git --version

On Windows PowerShell:

git --version

If Git is installed, you will see its version.

Example:

git version 2.x.xCode language: CSS (css)

If Git is not installed, visit:

https://git-scm.com/downloads

You can install GitHub CLI independently, but Git should also be installed if you intend to clone repositories, commit changes, or push code.


4. How to Install GitHub CLI on macOS

The easiest and recommended way to install GitHub CLI on macOS is through Homebrew.

This method supports both Intel Macs and Apple Silicon devices.

Step 1: Open Terminal

Open the Terminal application:

Applications โ†’ Utilities โ†’ Terminal

Alternatively, press Command + Space, search for Terminal, and open it.

Step 2: Check macOS Version

Execute:

sw_vers

Example:

ProductName: macOS
ProductVersion: 26.x
BuildVersion: ...Code language: HTTP (http)

Check your processor architecture:

uname -m

For Apple Silicon, the output is:

arm64

For Intel Macs:

x86_64

Homebrew selects the appropriate compatible package for your setup.

Step 3: Check Whether Homebrew Is Installed

Run:

brew --version

If Homebrew is installed, the version information will appear.

If you receive:

zsh: command not found: brewCode language: HTTP (http)

Homebrew may not be installed or configured in your shell.

Install Homebrew using the official installer:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Code language: JavaScript (javascript)

Review the script and its permissions before running it.

After installation, follow any instructions printed by the installer to configure the Homebrew shell environment.

Verify:

brew --version

Step 4: Update Homebrew

Before installing GitHub CLI, refresh Homebrew:

brew update

This updates Homebrew’s package metadata.

Step 5: Install GitHub CLI

Run:

brew install gh

Homebrew downloads and installs GitHub CLI.

The executable becomes available through your configured Homebrew command path.

Step 6: Verify GitHub CLI Installation

Execute:

gh --version

Example output:

gh version 2.x.x
https://github.com/cli/cli/releases/tag/v2.x.xCode language: JavaScript (javascript)

Your actual version may be newer.

Display available commands:

gh --help

If GitHub CLI displays command information, the installation has succeeded.

Step 7: Find the GitHub CLI Executable

Execute:

which gh

Or:

command -v gh

For Apple Silicon Macs, the path commonly looks like:

/opt/homebrew/bin/gh

For Intel Macs:

/usr/local/bin/gh

The actual location depends on your Homebrew configuration.

Step 8: Verify the Homebrew Package

Run:

brew list --versions ghCode language: PHP (php)

You can also inspect package information:

brew info gh

GitHub CLI is now successfully installed on macOS.

Alternative: Install GitHub CLI Without Homebrew

If you do not want to use Homebrew, download the official macOS binary or installer from:

https://github.com/cli/cli/releases/latest

Select the package matching your processor architecture and follow the installation instructions included with that release.

For routine macOS development, Homebrew is generally the simplest option.


5. How to Install GitHub CLI on Windows 10 and Windows 11

GitHub officially supports installing GitHub CLI on Windows through WinGet.

WinGet is Microsoft’s Windows Package Manager.

Method 1: Install GitHub CLI Using WinGet (Recommended)

Step 1: Open PowerShell

Open Windows PowerShell or PowerShell 7.

You can search for PowerShell from the Windows Start menu.

Step 2: Check Whether WinGet Is Installed

Execute:

winget --version

If available, WinGet displays its installed version.

If Windows reports that winget is not recognized, install or update App Installer through Microsoft’s supported distribution method.

WinGet is included in modern supported Windows environments through App Installer.

Step 3: Search for GitHub CLI

Run:

winget search GitHub.cliCode language: CSS (css)

The search should return GitHub CLI.

The package identifier is:

GitHub.cliCode language: CSS (css)

Step 4: Install GitHub CLI

Execute:

winget install --id GitHub.cli --source wingetCode language: CSS (css)

WinGet downloads the GitHub CLI package and starts its installation.

Accept any required package agreements and installation prompts.

Step 5: Open a New Terminal

After installation, close the existing Windows Terminal or PowerShell window and open a new one.

Important: The installer updates the Windows PATH. When using Windows Terminal, a completely new window may be needed; opening only a new tab may not refresh the environment.

Step 6: Verify the Installation

Run:

gh --version

Display help:

gh --help

Step 7: Locate the Executable

Execute:

Get-Command gh

Or:

where.exe ghCode language: CSS (css)

These commands identify the executable Windows is using.

Step 8: Confirm the Installed Package

Run:

winget list --id GitHub.cliCode language: CSS (css)

If the package appears, GitHub CLI is installed and managed through WinGet.

GitHub CLI is ready on Windows.

Method 2: Install GitHub CLI Using Scoop

If you already use the Scoop package manager, you can install GitHub CLI through Scoop.

Execute:

scoop install gh

Verify:

gh --version

To upgrade later:

scoop update gh

This method assumes Scoop is already installed.

Method 3: Install GitHub CLI Using Chocolatey

For systems that already use Chocolatey, run:

choco install gh -y

Verify:

gh --version

To upgrade:

choco upgrade gh -y

The Scoop and Chocolatey package distributions are community-supported installation alternatives.

Method 4: Install GitHub CLI Using an MSI Installer

If WinGet is unavailable, you can install GitHub CLI using the official MSI package.

Step 1: Download the Installer

Visit:

https://github.com/cli/cli/releases/latest

Download the Windows MSI installer matching your architecture.

An x64 installer normally follows a naming convention similar to:

gh_<version>_windows_amd64.msiCode language: HTML, XML (xml)

The actual filename depends on the release.

Step 2: Run the Installer

Double-click the downloaded MSI package.

Follow the installation wizard.

Administrator permissions may be required depending on the installation settings and system policies.

Step 3: Reopen PowerShell

Open a new PowerShell window and execute:

gh --version

Then:

gh --help

If both commands work, the installation was successful.


6. How to Install GitHub CLI on Ubuntu and Debian Linux

GitHub provides an official APT repository for Ubuntu, Debian, and compatible distributions.

Using this repository is recommended because distribution-maintained packages can lag behind official releases.

Step 1: Check Your Linux Distribution

Execute:

cat /etc/os-release

Check CPU architecture:

uname -m

Example output:

x86_64

Or:

aarch64

Step 2: Update Package Information

Run:

sudo apt update

Step 3: Install Required Utilities

Execute:

sudo apt install -y wget ca-certificates

These packages provide file downloading and trusted CA certificate support.

Step 4: Create the APT Keyring Directory

Run:

sudo mkdir -p -m 755 /etc/apt/keyrings

Step 5: Download GitHub CLI’s Repository Signing Key

Execute:

tmp_keyring=$(mktemp)

wget -q -O "$tmp_keyring" \
  https://cli.github.com/packages/githubcli-archive-keyring.gpgCode language: JavaScript (javascript)

Install the downloaded keyring:

sudo install -m 644 "$tmp_keyring" \
  /etc/apt/keyrings/githubcli-archive-keyring.gpgCode language: JavaScript (javascript)

Remove the temporary download:

rm -f "$tmp_keyring"Code language: JavaScript (javascript)

This registers the repository signing key for GitHub CLI.

Security note: GitHub CLI rotated its Linux repository signing keys effective September 5, 2026. If you have an older repository configuration, update the keyring using the current official documentation rather than disabling APT signature verification.

GitHub publishes the current signing key fingerprints in its Linux installation guide.

Step 6: Add the GitHub CLI APT Repository

Execute:

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/nullCode language: PHP (php)

This creates an APT source entry for GitHub CLI.

Step 7: Update Package Metadata

Run:

sudo apt update

APT refreshes the package metadata, including the GitHub CLI repository.

Step 8: Install GitHub CLI

Execute:

sudo apt install -y gh

APT downloads and installs the official GitHub CLI package.

Step 9: Verify Installation

Run:

gh --version

Display help:

gh --help

Locate the executable:

command -v gh

Check the package:

dpkg -l gh

Step 10: Inspect the Package Source

Execute:

apt-cache policy gh

This displays the installed and candidate versions and helps identify the repository from which APT obtained the package.

GitHub CLI is successfully installed on Ubuntu or Debian.


7. How to Install GitHub CLI on Fedora, RHEL, and CentOS

GitHub maintains official RPM packages that can be installed using DNF.

The commands differ slightly between DNF4 and DNF5.

Step 1: Check Your Linux Version

Run:

cat /etc/os-release

Check the package manager version:

dnf --version

If your system uses DNF5, follow Method 1.

If it uses DNF4, follow Method 2.

Method 1: Install GitHub CLI Using DNF5

Step 1: Install DNF5 Plugins

sudo dnf install -y dnf5-plugins

Step 2: Add the Official GitHub CLI Repository

sudo dnf config-manager addrepo \
  --from-repofile=https://cli.github.com/packages/rpm/gh-cli.repoCode language: JavaScript (javascript)

Step 3: Install GitHub CLI

sudo dnf install -y gh

Step 4: Verify Installation

gh --version

Check the package:

rpm -q gh

Method 2: Install GitHub CLI Using DNF4

Step 1: Install the Repository Management Plugin

sudo dnf install -y 'dnf-command(config-manager)'Code language: JavaScript (javascript)

Step 2: Add the GitHub CLI RPM Repository

sudo dnf config-manager --add-repo \
  https://cli.github.com/packages/rpm/gh-cli.repoCode language: JavaScript (javascript)

Step 3: Install GitHub CLI

sudo dnf install -y gh

Step 4: Verify Installation

gh --version
gh --help

Alternative: Fedora Community Repository

Fedora also provides a community-maintained package.

You can install it with:

sudo dnf install gh

However, the GitHub-maintained repository is preferable when you require releases published directly by the GitHub CLI maintainers.


8. Install GitHub CLI on Amazon Linux

For Amazon Linux 2, GitHub documents installation through its official RPM repository.

Step 1: Check the Operating System

cat /etc/os-release

Confirm that your system is Amazon Linux 2 before using these YUM-specific instructions.

Step 2: Install YUM Repository Utilities

sudo yum install -y yum-utils

Step 3: Add the GitHub CLI Repository

sudo yum-config-manager --add-repo \
  https://cli.github.com/packages/rpm/gh-cli.repoCode language: JavaScript (javascript)

Step 4: Install GitHub CLI

sudo yum install -y gh

Step 5: Verify Installation

gh --version
command -v gh

For Amazon Linux 2023, check the supported DNF repository instructions appropriate to the installed DNF version.


9. Install GitHub CLI on Other Linux Distributions

GitHub CLI is also available on several additional distributions.

Arch Linux

sudo pacman -S github-cli

Alpine Linux

sudo apk add github-cli

openSUSE and SUSE Linux

Add the official RPM repository:

sudo zypper addrepo \
  https://cli.github.com/packages/rpm/gh-cli.repoCode language: JavaScript (javascript)

Refresh repositories:

sudo zypper ref

Install GitHub CLI:

sudo zypper install gh

Linux with Homebrew

If Homebrew is already installed:

brew install gh

Alternative: Download Standalone Binaries

Official GitHub CLI binaries are also available from:

https://github.com/cli/cli/releases/latest

Download the archive matching your operating system and processor architecture.

Verify the archive’s authenticity before extracting and installing it.


10. How to Authenticate GitHub CLI

After installing GitHub CLI, you need to authenticate with your GitHub account to access private repositories and perform authorized GitHub operations.

Step 1: Start GitHub Authentication

Execute:

gh auth login

The CLI starts an interactive authentication process.

You may be prompted with options similar to:

? Where do you use GitHub?
> GitHub.com
  OtherCode language: PHP (php)

Select GitHub.com unless you use a GitHub Enterprise host.

Step 2: Choose Your Git Protocol

GitHub CLI asks which protocol you want to use for Git operations.

Typical choices are:

HTTPS
SSH

For beginners, HTTPS is often easier to configure.

SSH is useful if you already manage SSH keys for Git operations.

Step 3: Authenticate Through Your Browser

Select browser-based authentication.

Alternatively, start the browser flow directly:

gh auth login --web

To copy the temporary authentication code to your clipboard:

gh auth login --web --clipboard

The CLI initiates the GitHub device authentication process.

If required, visit:

https://github.com/login/device

Enter the one-time code displayed in your terminal and approve the authorization.

Step 4: Verify GitHub Authentication

After login, execute:

gh auth status

This shows the configured authentication state for known GitHub hosts.

It can display the active account, authentication method, and stored credential information without revealing the token by default.

Step 5: Configure Git Credential Integration

For HTTPS-based Git authentication, execute:

gh auth setup-git

This configures Git to use GitHub CLI as a credential helper for authenticated hosts.

It can simplify authenticated Git operations such as:

git clone
git fetch
git pull
git pushCode language: PHP (php)

When using SSH, make sure your SSH key is correctly configured and authorized for GitHub.

Step 6: Confirm Everything Works

Run:

gh repo view cli/cli

This displays information about GitHub CLI’s own public repository.

If repository details appear, the CLI can successfully communicate with GitHub.


11. Essential GitHub CLI Commands for Beginners

After installing and authenticating GitHub CLI, try these commands.

Check CLI Version

gh --version

Check Authentication Status

gh auth status

List Your Repositories

gh repo listCode language: PHP (php)

To display more results:

gh repo list --limit 50Code language: PHP (php)

View a Repository

gh repo view cli/cli

Clone a Repository

gh repo clone cli/cliCode language: PHP (php)

This creates a local copy of the repository in your current directory.

List GitHub Issues

Within a GitHub repository:

gh issue listCode language: PHP (php)

Or specify the repository explicitly:

gh issue list --repo cli/cliCode language: PHP (php)

List Pull Requests

gh pr listCode language: PHP (php)

For a specific repository:

gh pr list --repo cli/cliCode language: PHP (php)

Check Pull Request Status

gh pr status

Create a Pull Request

When you are working on a branch with changes ready for review:

gh pr create

To prefill the title and description from commits:

gh pr create --fill

This operation creates a real pull request after any required prompts and permissions checks.

View GitHub Actions Workflows

gh workflow listCode language: PHP (php)

View GitHub Actions Runs

gh run listCode language: PHP (php)

List GitHub Releases

gh release listCode language: PHP (php)

Execute a GitHub API Request

For example, retrieve the authenticated user’s information:

gh api user

This returns JSON data from the GitHub API.

Log Out

gh auth logout

You can also target GitHub.com explicitly:

gh auth logout --hostname github.comCode language: CSS (css)

12. Configure GitHub CLI Settings

GitHub CLI provides configuration commands for customizing its behavior.

View Current Configuration

gh config listCode language: PHP (php)

Configure HTTPS for Git Operations

gh config set git_protocol https --host github.comCode language: JavaScript (javascript)

Configure SSH for Git Operations

gh config set git_protocol ssh --host github.comCode language: JavaScript (javascript)

Use SSH only after ensuring that the appropriate SSH keys are configured.

Configure VS Code as the Default Editor

gh config set editor "code --wait"Code language: JavaScript (javascript)

This requires the VS Code code command to be available in PATH.

Configure Vim as the Default Editor

gh config set editor vimCode language: JavaScript (javascript)

Check a Configuration Value

gh config get git_protocolCode language: JavaScript (javascript)

Configuration settings allow you to tailor GitHub CLI to your preferred development workflow.


13. How to Update GitHub CLI

GitHub CLI receives ongoing updates, so keeping your installation current is recommended.

The upgrade procedure depends on your installation method.

macOS

brew update
brew upgrade gh

Windows โ€” WinGet

winget upgrade --id GitHub.cliCode language: CSS (css)

Windows โ€” Scoop

scoop update gh

Windows โ€” Chocolatey

choco upgrade gh

Ubuntu/Debian

sudo apt update
sudo apt install gh

Fedora/RHEL/CentOS

sudo dnf update gh

Amazon Linux 2

sudo yum update gh

Arch Linux

sudo pacman -Syu

After upgrading, always verify:

gh --version

For automated production environments, consider pinning a tested GitHub CLI release rather than automatically updating to every newly published version.


14. Troubleshooting GitHub CLI Installation Errors

The following table covers common installation and authentication issues.

Error or symptomLikely causeTroubleshooting
gh: command not foundCLI missing or PATH not configuredVerify installation and executable path
zsh: command not found: brewHomebrew not installed or not on PATHInstall/configure Homebrew
gh is not recognizedWindows PATH not refreshedOpen a new terminal and check PATH
winget is not recognizedWinGet unavailableInstall or update Windows App Installer
Unable to locate package ghAPT repository missing or outdatedCheck official repository and run apt update
NO_PUBKEY or GPG errorMissing, outdated, or incorrect repository signing keyReinstall the current official keyring
exec format errorIncorrect binary architectureDownload the appropriate binary
HTTP 401Authentication missing or invalidCheck gh auth status and reauthenticate
HTTP 403Insufficient permissions or policy restrictionsReview account, token, and repository access
Permission denied (publickey)SSH authentication failureVerify SSH key and remote configuration
Git push authentication failsGit credential helper or remote configuration issueInspect remote URL and configure gh auth setup-git

Troubleshooting 1: gh Command Not Found on macOS

Execute:

command -v gh

Verify the Homebrew package:

brew list --versions ghCode language: PHP (php)

Check the PATH:

echo "$PATH"Code language: PHP (php)

If the package is installed but the executable is not available, confirm Homebrew is properly configured in the shell.

Troubleshooting 2: gh Not Recognized on Windows

Run:

Get-Command gh

Check PATH:

$env:PathCode language: PHP (php)

If GitHub CLI was just installed through MSI or WinGet, close Windows Terminal completely and open it again.

If the command remains unavailable, inspect the installer status and the actual location of gh.exe.

Troubleshooting 3: APT Cannot Locate the gh Package

First check the configured repository:

cat /etc/apt/sources.list.d/github-cli.listCode language: PHP (php)

Refresh metadata:

sudo apt update

Check package availability:

apt-cache policy gh

If the official GitHub CLI repository is missing, configure it using the instructions in Section 6.

If the package repository reports a signature verification problem, correct the repository signing key instead of bypassing package signature checks.

Troubleshooting 4: GitHub CLI Authentication Failed

Run:

gh auth status

If authentication is invalid or missing, repeat login:

gh auth login

For browser-based authentication:

gh auth login --web

If using GitHub Enterprise, specify the correct host:

gh auth login --hostname github.example.comCode language: CSS (css)

Replace github.example.com with your organization’s actual GitHub Enterprise hostname.

Troubleshooting 5: SSH Permission Denied

Example:

git@github.com: Permission denied (publickey).Code language: HTTP (http)

This typically indicates an SSH authentication problem rather than a GitHub CLI installation issue.

Inspect your SSH connection:

ssh -T git@github.comCode language: CSS (css)

Check the Git remote:

git remote -v

If your Git remote uses HTTPS instead, you can configure GitHub CLI as the credential helper:

gh auth setup-git

For SSH-based operations, verify that a valid SSH key is registered with your GitHub account.

Troubleshooting 6: Multiple Versions of gh Installed

On macOS or Linux:

type -a gh

On Windows:

Get-Command gh -All

This helps identify multiple installations.

For example, one executable may come from a package manager and another from a manually downloaded binary.

Make sure your PATH resolves to the intended installation.


15. How to Uninstall GitHub CLI

If you no longer need GitHub CLI, remove it using the package manager that installed it.

macOS

brew uninstall gh

Windows โ€” WinGet

winget uninstall --id GitHub.cliCode language: CSS (css)

Windows โ€” Scoop

scoop uninstall gh

Windows โ€” Chocolatey

choco uninstall gh

Ubuntu/Debian

sudo apt remove gh

Fedora/RHEL/CentOS

sudo dnf remove gh

Amazon Linux 2

sudo yum remove gh

Arch Linux

sudo pacman -R github-cli

Removing the executable does not necessarily remove all stored configuration or credentials.

If you want to disconnect your GitHub account before uninstalling, run:

gh auth logout

Be aware that logging out of GitHub CLI does not automatically revoke all previously issued credentials on the GitHub server. Revoke access through GitHub account settings if needed.


16. GitHub CLI Installation Cheat Sheet

Operating systemRecommended command
macOS Intelbrew install gh
macOS Apple Siliconbrew install gh
Windows 10/11winget install --id GitHub.cli
Windows with Scoopscoop install gh
Windows with Chocolateychoco install gh
Ubuntu/DebianConfigure official repository, then sudo apt install gh
Fedora with DNFConfigure official repository, then sudo dnf install gh
RHEL/CentOSConfigure official RPM repository, then sudo dnf install gh
Amazon Linux 2Configure official RPM repository, then sudo yum install gh
Arch Linuxsudo pacman -S github-cli
Alpine Linuxsudo apk add github-cli
openSUSEConfigure official repository, then sudo zypper install gh
Verify installationgh --version
Authenticategh auth login
Check authenticationgh auth status
Configure Git credentialsgh auth setup-git

17. Frequently Asked Questions

Q1. Is GitHub CLI free?

Yes. GitHub CLI is free and open source.

Some operations may interact with GitHub features or resources that have separate usage limits or billing requirements.

Q2. Do I need Git installed to use GitHub CLI?

GitHub CLI can be installed independently of Git.

However, normal Git repository operations require Git, so installing both is recommended.

Q3. Can GitHub CLI be installed on Apple Silicon Macs?

Yes. GitHub CLI supports Apple Silicon through compatible macOS packages, including Homebrew.

Q4. Does GitHub CLI work on Windows 11?

Yes. GitHub CLI supports Windows and can be installed using WinGet or an official MSI installer.

Q5. Can I use GitHub CLI without opening a browser?

Yes, certain operations work without browser interaction.

For authentication on a workstation, the standard browser-based authorization is usually convenient. For automation, GitHub CLI supports suitable authentication tokens supplied through environment variables.

Q6. Can GitHub CLI be used in GitHub Actions?

Yes. GitHub CLI is preinstalled on GitHub-hosted Actions runners.

For workflows that need GitHub authentication, configure the appropriate token and permissions.

For example, within a GitHub Actions workflow:

env:
  GH_TOKEN: ${{ github.token }}

The workflow’s permissions must allow the requested operations.

Q7. Can GitHub CLI manage private repositories?

Yes, provided the authenticated identity has access to those repositories and sufficient permissions for the requested commands.

Q8. Can I use GitHub CLI with multiple GitHub accounts?

Yes. GitHub CLI supports managing authenticated accounts and switching the active account.

You can inspect the authentication state:

gh auth status

And switch among configured accounts:

gh auth switchCode language: JavaScript (javascript)

Q9. Can GitHub CLI connect to GitHub Enterprise?

Yes. GitHub CLI supports GitHub.com, GitHub Enterprise Cloud, and supported GitHub Enterprise Server versions.

You can specify a host with:

gh auth login --hostname github.example.comCode language: CSS (css)

Q10. Is GitHub CLI better than using the GitHub website?

Neither replaces the other completely.

GitHub CLI is particularly useful for repetitive operations, terminal-centric development, scripting, CI/CD, and automation.

The web interface remains valuable for visual reviews, repository administration, and more complex collaboration tasks.


18. GitHub CLI Best Practices

For secure and reliable use, follow these guidelines:

  1. Install GitHub CLI from official package repositories or trusted installers.
  2. Keep your CLI version updated with security and compatibility fixes.
  3. Use a secure authentication method and avoid exposing credentials.
  4. Prefer short-lived, appropriately scoped credentials for automation.
  5. Never commit access tokens or credentials to Git repositories.
  6. Avoid passing sensitive tokens directly as command-line arguments.
  7. Verify the active GitHub account and target repository before modifying resources.
  8. Use GitHub CLI as a Git credential helper when appropriate for HTTPS workflows.
  9. Review permissions before executing commands that modify repositories, issues, workflows, or releases.
  10. Pin tested CLI versions in reproducible CI/CD environments.

For automation, prefer securely supplied environment variables such as GH_TOKEN rather than interactive gh auth login sessions.

19. Conclusion

GitHub CLI (gh) is an essential command-line tool for developers, DevOps engineers, platform engineers, and anyone working extensively with GitHub.

It simplifies repository administration, pull request management, issue tracking, GitHub Actions monitoring, and automation.

Installation is straightforward across major operating systems:

  • macOS: Install through Homebrew using brew install gh.
  • Windows: Install through WinGet using winget install --id GitHub.cli.
  • Ubuntu/Debian: Install using the official GitHub CLI APT repository.
  • Fedora/RHEL/CentOS: Install from GitHub’s official RPM repository using DNF.
  • Other Linux systems: Use the appropriate package manager or an official standalone binary.

After installation, the three most important commands are:

gh --version
gh auth login
gh auth status

Once GitHub CLI is installed and authenticated, you can manage your GitHub development workflows directly from your terminal, reduce context switching, and build more efficient automation.


Official Documentation and References

Last reviewed: October 20, 2026. Installation methods, package metadata, and CLI capabilities may change. Always check the latest official documentation when configuring production or enterprise environments.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

How to Configure pre-commit for Terraform: Complete DevOps Guide with 15 Practical Use Cases, Commands, Security Checks, and Best Practices

Terraform pre-commit Hooks: Installation, Configuration, TFLint, Trivy, Checkov & CI/CD Guide Learn to configure pre-commit for Terraform with step-by-step commands, terraform fmt, validate, TFLint, Trivy, Checkov, terraform-docs,…

Read More

How to Install and Configure pre-commit on macOS, Windows, and Linux: Complete Step-by-Step Guide

SEO Title: How to Install and Configure pre-commit on Mac, Windows & Linux (2026) Meta Description: Learn how to install and configure pre-commit Git hooks on macOS,…

Read More

How to Install Datadog CLI on macOS, Windows, and Linux: Complete Step-by-Step Guide

SEO Title: How to Install Datadog CLI on Mac, Windows & Linux โ€“ Complete 2026 Tutorial Meta Description: Learn how to install Datadog Pup CLI and Datadog…

Read More

How to Install MongoDB Atlas CLI on Mac, Windows, and Linux: Complete Step-by-Step Tutorial

SEO Title: Install MongoDB Atlas CLI on macOS, Windows & Linux โ€“ Complete Guide Meta Description: Learn how to install MongoDB Atlas CLI on macOS, Windows, Ubuntu,…

Read More

How to Install Confluent CLI on macOS, Windows, and Linux: Complete Step-by-Step Guide

Meta Title: How to Install Confluent CLI on Mac, Windows & Linux (2026) Meta Description: Learn how to install and configure Confluent CLI on macOS, Windows, Ubuntu,…

Read More

From Side Hustle to Smart Business: A Practical Guide to Building, Growing, and Managing an Online Venture

Discover how entrepreneurs can combine digital marketing, global marketplaces, affordable technology, financial compliance, and modern operations to create sustainable businesses. Introduction: The New Age of Digital Entrepreneurship…

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x