|

GitHub CLI User Manual – Installation & Usage on Ubuntu

Download MarkDown
Sarvendra Singh
Sarvendra Singh
Jun 14, 2026·3 min read

What is GitHub CLI?

GitHub CLI (gh) is the official command-line tool developed by GitHub that allows developers to manage repositories, pull requests, issues, workflows, and releases directly from the terminal.

It simplifies GitHub operations without needing to switch between browser and terminal.

Why Use GitHub CLI?

  • Manage repositories from the terminal
  • Create and review pull requests
  • Manage issues easily
  • Run and monitor GitHub Actions workflows
  • Automate DevOps tasks
  • Faster development workflow

System Requirements

Before installing GitHub CLI on Ubuntu, ensure:

  • Ubuntu 20.04 / 22.04 / 24.04
  • sudo access
  • Internet connection
  • Git installed (git --version)

If Git is not installed:

sudo apt update
sudo apt install git -y
GitHub CLI User Manual – Installation & Usage on Ubuntu

Install via Official Repository (Recommended)

Step 1: Update system packages

sudo apt update

Add GitHub CLI GPG key:

curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | \
sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
GitHub CLI User Manual – Installation & Usage on Ubuntu

Add official repository:

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
GitHub CLI User Manual – Installation & Usage on Ubuntu

Install GitHub CLI

GitHub CLI User Manual – Installation & Usage on Ubuntu
Verify Installation

Check installed version:

gh --version
GitHub CLI User Manual – Installation & Usage on Ubuntu

Authenticate GitHub CLI

After installation, authenticate your GitHub account.

gh auth login

You will be prompted to:

  • Choose GitHub.com
  • Select HTTPS
  • Authenticate via browser

Browser Authentication:
URL: https://github.com/login/device

GitHub CLI User Manual – Installation & Usage on Ubuntu
GitHub CLI User Manual – Installation & Usage on Ubuntu

Once completed,

Verify authentication:

gh auth status
GitHub CLI User Manual – Installation & Usage on Ubuntu

📘 GitHub CLI Command List (With Purpose & Example)

#CommandPurposeExample
1gh auth loginAuthenticate GitHub accountgh auth login
2gh auth statusCheck login statusgh auth status
3gh auth logoutLogout from GitHubgh auth logout
4gh repo createCreate new repositorygh repo create my-project --public
5gh repo cloneClone repositorygh repo clone username/repo-name
6gh repo viewView repository detailsgh repo view username/repo-name
7gh repo deleteDelete repositorygh repo delete username/repo-name
8gh repo forkFork repositorygh repo fork username/repo-name
9gh pr createCreate pull requestgh pr create --title "Feature" --body "Added feature"
10gh pr listList pull requestsgh pr list
11gh pr viewView pull requestgh pr view 1
12gh pr checkoutCheckout PR locallygh pr checkout 1
13gh pr mergeMerge pull requestgh pr merge 1
14gh issue createCreate issuegh issue create --title "Bug" --body "Fix needed"
15gh issue listList issuesgh issue list
16gh issue viewView issuegh issue view 5
17gh issue closeClose issuegh issue close 5
18gh workflow listList workflowsgh workflow list
19gh run listList workflow runsgh run list
20gh run viewView workflow rungh run view 123456
21gh run watchWatch workflow run livegh run watch
22gh release createCreate releasegh release create v1.0.0 --title "Version 1.0"
23gh release listList releasesgh release list
24gh config listView CLI configurationgh config list
25gh alias setCreate command shortcutgh alias set prl "pr list"
26gh search reposSearch repositoriesgh search repos devops scripts
27gh search issuesSearch issuesgh search issues "login bug"

Common Errors & Troubleshooting

Error: gh command not found

Solution:

  • Ensure installation is completed successfully
  • Restart terminal
  • Check the PATH variable

Authentication Failed

Solution:

gh auth logout
gh auth login

Advantages of Using GitHub CLI in DevOps

  • Ideal for CI/CD pipelines
  • Useful for automation scripts
  • Integrates with GitHub Actions
  • Faster repository management
  • Works well on Ubuntu servers

Conclusion

GitHub CLI is a powerful tool for developers and DevOps engineers working on Ubuntu systems. It simplifies repository management, pull requests, and issue tracking directly from the terminal.

Installing GitHub CLI on Ubuntu is quick and secure using the official repository method. After authentication, you can manage almost all GitHub features without using a web browser.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *