February 23, 2026
3 min read
By Axel Minart

Table of Contents

This is a list of all the sections in this post. Click on any of them to jump to that section.

GitHub CLI: The Complete Guide to Using GitHub from Your Terminal

In modern software development, we spend a lot of time on GitHub: creating repositories, managing pull requests, reviewing code, handling issues…

But what if you could do all of that without opening your browser?

In this article, we’ll explore GitHub CLI, the official tool that lets you interact with GitHub directly from your terminal.


🚀 What is GitHub CLI?

GitHub CLI (command: gh) is GitHub’s official command-line tool.

It allows you to:

  • Create and manage repositories
  • Open and manage Pull Requests
  • Create and assign Issues
  • Trigger GitHub Actions workflows
  • Automate development tasks

👉 In short: you control GitHub without leaving your terminal.


💻 Installation

Windows

winget install --id GitHub.cli

linux

The command can depend on your linux distribution

sudo apt install gh

🔐 Authentication

Once installed, run:

gh auth login

You’ll be guided to:

  • Choose GitHub.com or GitHub Enterprise

  • Authenticate via browser or token

  • Select your preferred protocol (HTTPS or SSH)

After this step, your terminal is connected to your GitHub account.

📁 Essential Commands

1️⃣ Create a Repository

gh repo create my-project

Useful options:

gh repo create my-project --public --source=. --remote=origin --push

This will:

  • Create the repository on GitHub

  • Link it to your local folder

  • Automatically push your code

2️⃣ Clone a Repository

gh repo clone username/repository

3️⃣ Create a Pull Request

gh pr create

The interactive assistant will ask for:

  • The base branch
  • The title
  • The description

You can also automate it:

gh pr create --title "New Feature" --body "Adds the new feature implementation"

4️⃣ List Pull Requests

gh pr list

5️⃣ Create an Issue

gh issue create

You can also specify details directly:

gh issue create --title "Bug in login flow" --body "Error occurs when submitting the form"

🔄 Practical Workflow Example

Here’s a simple real-world workflow using GitHub CLI:

  • Initialize your local project

  • Create a repository:

gh repo create my-app --public --source=. --push
  • Create a new branch and implement a feature

  • Push your branch:

git push origin feature-branch
  • Open a Pull Request:
gh pr create
  • Merge the PR:
gh pr merge

All without opening GitHub in your browser.