Tutorials: The GitHub CLI is a free, open-source tool that brings GitHub's web-based features directly into your computer's command line or terminal
The URL https://cli.github.com/ is the official homepage for the GitHub CLI (commonly invoked using the terminal command gh).
The GitHub CLI is a free, open-source tool that brings GitHub's web-based features directly into your computer's command line or terminal.
Key Purpose: Eliminating "Context Switching"
Normally, when developing software, you use Git in your terminal to manage your code locally (e.g., git commit, git push), but you have to open a web browser to handle GitHub-specific features. The GitHub CLI removes the need to switch back and forth between your code editor, your browser, and your terminal.
What can you do with it?
Instead of using the GitHub website, you can type gh commands to:
Manage Pull Requests (
gh pr): Create, checkout, review, diff, and merge pull requests locally.Track Issues (
gh issue): List, view, create, filter, and close bug reports or task issues.Handle Repositories (
gh repo): View, clone, create, fork, or star repositories without leaving the terminal.Interact with GitHub Actions (
gh run/gh workflow): View the progress and logs of automated testing and deployment workflows.Interact with GitHub Copilot (
gh copilot): Get AI assistance right in your CLI.Automate & Script: Create custom aliases or script repetitive GitHub tasks using their built-in API tool (
gh api).
How it differs from standard Git
Git (
git): Focuses on managing the source code history, creating local branches, and tracking changes locally or on any hosting service.GitHub CLI (
gh): Focuses on managing the features unique to GitHub (like PRs, Issues, and Actions) that standard Git doesn't natively control.
To install the GitHub CLI (gh) on Ubuntu, you should use the official GitHub repository. This ensures you get the latest version (the version in the default Ubuntu apt repositories is often outdated).
Download zone : ------------------------------------------------------------------------
👉 Intermadiate Statistics with R (Montana State University)
👉 linux_shell_commands_cheat_sheet.pdf
👉 [Download "Python Notes for Professionals" for Free Here] (Insert your link here: https://goalkicker.com/PythonBook/PythonNotesForProfessionals.pdf)
Have you read this book yet? Let me know your favorite Python tip or trick in the comments below!
📥 Linux Magazin Ro (July 2026)
Stop wasting hours filtering through fragmented, outdated forum posts. Equip your digital toolkit with clean, verified, and reproducible technical blueprints.
👉 Download the Complete Open-Source & Tech Compilation on Gumroad Now!
Have questions about any of the configurations or setup guides included in the PDF? Drop a comment down below and let's discuss!
Simply click the link below to download the PDF, print your favorite puzzles, and start solving!
👉 [[Download 100_sudoku_puzzles.pdf Here]]
*If you enjoy these puzzles, I would love to hear your feedback
-------------------------------------------------------------------------------------------------------------------
Follow these steps in your terminal:
1. Install dependencies
First, make sure your package list is updated and install curl and git if you don't already have them:
sudo apt update
sudo apt install curl git coreutils -y
2. Download and add the official GitHub CLI keyring
This step securely adds GitHub's public key to your system so Ubuntu trusts the packages you download:
sudo mkdir -p -m 755 /etc/apt/keyrings
curl -fsSL 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
3. Add the GitHub CLI repository to your sources
Run the following command to add the repository to your system's package manager configuration:
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.p/github-cli.list > /dev/null
4. Update your package list and install gh
Now that Ubuntu knows about the official repository, update your package lists again and install the CLI:
sudo apt update
sudo apt install gh -y
Alternative: Install via Snap (Easiest)
If you prefer using Snap (which comes pre-installed on standard Ubuntu), you can install it with a single command:
sudo snap install gh
Note: While Snap is easier, the apt method above is generally recommended for development environments as it integrates better with local file permissions and SSH keys.
Next Step: Authenticate with GitHub
Once installed, you need to link the CLI to your GitHub account. Run the following command and follow the on-screen prompts:
gh auth login
It will ask you whether you want to log in via a web browser or by pasting an authentication token. Browser authentication is usually the quickest and easiest.
Now that you have it installed and authenticated, using gh is incredibly intuitive. The tool is structured around "nouns" (the feature you want to use, like pr, issue, or repo) and "verbs" (the action you want to take, like create, list, or view).
Here is a quick cheat sheet on how to use the GitHub CLI for your everyday workflow.
1. Working with Repositories (gh repo)
Instead of going to GitHub.com to create or clone repositories, you can do it right here.
Clone a repository: (No need to copy the full URL, just use
username/repo)Bashgh repo clone owner/repository-nameCreate a new repo: (This will create it on GitHub and can also initialize it locally)
Bashgh repo create my-new-project --publicView the current repo: (Opens the current repository's GitHub page in your browser)
Bashgh repo view --web
2. Managing Pull Requests (gh pr)
This is where the GitHub CLI truly shines. You can manage the entire PR lifecycle without leaving your terminal.
Create a PR: (Pushes your current branch and opens a PR on GitHub)
Bashgh pr create --title "Fix login bug" --body "Splits the authentication function into smaller chunks."List open PRs: (See all open pull requests for the current repository)
Bashgh pr listCheckout a PR locally: (Incredibly useful for testing a teammate's code. You don't need to know their branch name, just the PR number)
Bashgh pr checkout 42Merge a PR: (Merges PR #42 right from your terminal)
Bashgh pr merge 42
3. Tracking Issues (gh issue)
List issues: (See what needs to be worked on)
Bashgh issue listCreate a new issue:
Bashgh issue create --title "Dark mode toggle is broken" --body "The button switches state but colors don't change."View a specific issue:
Bashgh issue view 105
4. Checking GitHub Actions (gh run)
If you use GitHub Actions for continuous integration (CI/CD), you can check your build statuses.
View recent workflow runs:
Bashgh run listWatch a live run: (See the steps pass or fail in real-time inside your terminal)
Bashgh run watch
💡 Pro-Tip: The --help Flag
If you ever get stuck or forget a command, just add --help to the end of any command. The built-in documentation is excellent.
gh --help
gh pr --help
gh pr create --help
Comments
Post a Comment