Getting Started with GitHub CLI

Learn about the super command line tool that makes it easy to create, view, and manage GitHub repositories.

Getting Started with GitHub CLI
Image by Author


GitHub CLI brings all of the GitHub features to your command line interface. You can create a new remote repository, view it and modify it by just typing a few keywords. Moreover, it lets you launch codespace, manage gists, and run GitHub actions.

Key features:

  • Fast authentication.
  • View repositories, pull requests, commit, and a file on a web browser.  
  • Create, view and manage codespaces
  • Create, publish, and manage GitHub repositories. 
  • Create, view, publish, and manage GitHub gits. 
  • Check the status of the issues, create new issues, and view issues in the terminal.
  • Create pull request, Review it, and merge it by using command line. 
  • View list of GitHub Actions workflow and manage both workflows and runs. 
  • View the global status of your githUb profile.


Quick Setup




First, we need to install the CLI tool and it is available for all operating systems. 


GitHub CLI can be installed easily using the Homebrew CLI tool. It is also available on MacPorts, Conda, Spack, and as a downloadable binary.

$ brew install gh


$ brew upgrade gh



GitHub CLI can be installed easily using the Winget CLI tool. It is also available on scoop, Chocolatey, Conda, and as downloadable MSI.

$ winget install --id GitHub.cli


$ winget upgrade --id GitHub.cli



GitHub CLI can be installed using apt in Ubuntu and binary installation from Releases · cli/cli.

$ sudo apt update
$ sudo apt install gh




After Installation you need to authenticate with a GitHub host.. 

Launch a browser to authenticate, use:

$ gh auth login


After completion, an authentication token will be stored internally.

You can also authenticate against by reading the token from a file

$ gh auth login --with-token < mytoken.txt


Note: you might need additional authentication for launching codespace for the first time. It is quite easy, just like browser authentication.


GitHub CLI commands


After successful authentication, you can try to write a simple command to check the status:

$ gh status


The above command will show Assigned Issues, Assigned Pull Requests, Review Requests, Mentions, and Repository Activity.

Or type: 

gh repo list [user-name]


To see the list of the public and private repositories. 


Getting Started with GitHub CLI
Gif by Author


GitHub CLI is evolving and now you can access everything that is available on the GitHub ecosystem. 

Here is the list of what you can do with GitHub CLI:

  1. Create shortcuts for gh commands using alias. 
  2. Browse almost everything on Github website using a single command. 
  3. Create, view, interact, and manage codespaces, gits, repositories, and GitHub actions. 
  4. Adding and managing gh extensions.
  5. Reviewing, editing, and merging Pull requests and Issues. 
  6. Setting secrets, ssh-key, and gpg-key.
  7. Experience interactive search.
  8. And configurations.

Learn all about GitHub commands and examples by reading the manual.




If you are new and want to learn everything about Git and GitHub, read Github and Git Tutorial for Beginners. You will learn how Git works, basic commands, and how you can use it in data science projects. Moreover, you will learn about the GitHub collaborative platform and how you can create your first githUb repository by following a few steps.  

GitHub CLI is for professionals and beginners. It just makes your life easy by providing commands to all of the GitHub features. You can also automate your setup using the commands and create aliases for repetitive commands. 

With GitHub CLI you can build, test, deploy, and collaborate on the project without leaving the IDE which makes it a super tool.
Abid Ali Awan (@1abidaliawan) is a certified data scientist professional who loves building machine learning models. Currently, he is focusing on content creation and writing technical blogs on machine learning and data science technologies. Abid holds a Master's degree in Technology Management and a bachelor's degree in Telecommunication Engineering. His vision is to build an AI product using a graph neural network for students struggling with mental illness.