How To Use GitHub from your terminal with GitHub CLI

Steve Pesce
3 min readSep 19, 2020


Personally, I never liked switching back and forth between my browser and terminal when working with git repos on GitHub. For this reason, I was excited to hear about the new GitHub CLI.

Installing GitHub CLI 1.0 (beta)


  • homebrew:
brew install gh
  • macPorts:
sudo port install gh


  • scoop:
scoop bucket add github-gh
scoop install gh
  • chocolatey:
choco install gh
  • manual:
download the msi from


If you have Homebrew installed, you can simply use:

brew install gh
  • apt:
sudo apt-key adv --keyserver --recv-key C99B11DEB97541F0
sudo apt-add-repository
sudo apt update
sudo apt install gh
  • dnf:
sudo dnf config-manager --add-repo
sudo dnf install gh
  • zypper:
sudo zypper addrepo
sudo zypper ref
sudo zypper install gh
  • manual:
download the tar from

I will be using Homebrew on WSL Ubuntu for my setup. Follow the appropriate installation instructions from the step above, and you should have the same results.

Follow installation instructions


You must connect to your GitHub account to start using the CLI.

Run gh auth login to start connecting your account.

Next select and then selectPaste an authentication token

Note: I already authenticated, I am reauthenticating to show the process.

Follow the link to get your token: , generate a new token, and paste it into the terminal.

Now select your protocol, I use SSH.

Optional: Run gh auth status to make sure you are logged in.

Creating a New Repo

To create a repo run gh repo your-repo-name

Optionally, you can use flags, for example the -d flag sets the repo’s description.

Include a description when creating a repo

You will need to tell git where to push for your first push.

Cloning a Repo

gh repo clone <repo>

You can clone a repo using the owner/repo syntax. For example, to clone the repo that I just created, you would use gh repo clone sPesce/my-descriptive-repo . For this example, I will clone the GitHub CLI repo.

That should be enough to get you familiar. GitHub CLI has great documentation — the manual should guide you in performing any of its other functions.