Mastering GitHub CLI Installation on Linux: Streamline Your Dev Workflow
Think you need the GitHub web interface for everything? Think again. Unlock the power of GitHub CLI on Linux to eliminate context switching, automate workflows, and own your dev environment like a pro.
For many developers, working on projects often means juggling between the terminal and a browser to manage GitHub repositories. But what if you could bring all that functionality right into your terminal? That’s where GitHub CLI (gh) comes in — a powerful tool that seamlessly integrates GitHub actions into your Linux command line.
In this post, I’ll walk you through how to install GitHub CLI on Linux, so you can streamline typical GitHub tasks like issue management, pull requests, and repository browsing—all without leaving your terminal.
Why Install GitHub CLI?
GitHub CLI empowers developers to:
- Create, view, and comment on issues and pull requests directly.
- Clone repositories without opening a browser.
- Automate repetitive GitHub tasks in scripts.
- Stay focused on coding without switching apps.
If this sounds appealing, read on for a step-by-step installation guide tailored for Linux users.
Step 1: Check Your Linux Distribution
GitHub CLI is available via package managers for most popular Linux distros including Ubuntu/Debian, Fedora, CentOS, and Arch Linux. The installation method varies slightly depending on which one you use.
Step 2: Installation Methods by Distribution
For Ubuntu / Debian-based Systems
- Add the official GitHub CLI repository
Open your terminal and run:
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
Then add the repo:
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
- Update package lists
sudo apt update
- Install gh
sudo apt install gh
- Verify installation
gh --version
For Fedora
Simply use DNF package manager:
sudo dnf install 'dnf-command(config-manager)'
sudo dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
sudo dnf install gh
Verify with:
gh --version
For CentOS / RHEL
Enable EPEL repository first if not already enabled:
sudo yum install epel-release
Then add the repo and install:
sudo yum-config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
sudo yum install gh
Check version:
gh --version
For Arch Linux
Use the official community repository:
sudo pacman -S github-cli
Verify with:
gh --version
Step 3: Authenticate with GitHub
Once installed, you need to authenticate gh
to allow it access to your GitHub account.
Run:
gh auth login
You’ll be prompted with options like authenticating via web or SSH keys — follow through accordingly.
Bonus: Quick Commands to Test Your New Tool
- Clone a repo
gh repo clone cli/cli
- Create a new issue
Navigate to your repo folder and run:
gh issue create --title "Bug report" --body "Describe the bug here..."
- View pull requests
In repo folder:
gh pr list
Wrapping Up
Installing GitHub CLI on Linux is straightforward but unlocks powerful capabilities that accelerate development workflows by keeping interactions terminal-centric. No more context switching or manual navigation through the web UI — gh
makes managing repositories effortless from the command line.
Give it a try today! Once familiar with its commands, you'll wonder how you ever managed without it.
If you found this guide useful or have questions about integrating more advanced scripting with gh
, leave a comment or reach out!
Happy coding! 🚀