DEV Community

Cover image for Get GitHub CLI in WSL2
Abhishek Sisodiya
Abhishek Sisodiya

Posted on

Get GitHub CLI in WSL2

Get the new GitHub CLI now in your wsl2 dev environment.

gh helps you work with issues, pull requests, releases and more. It brings GitHub to your terminal.

Installation

For people using Debian based WSL2 use these commands to install gh

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0
sudo apt-add-repository https://cli.github.com/packages
sudo apt update
sudo apt install gh
Enter fullscreen mode Exit fullscreen mode

For people using wsl based on OpenSUSE, Fedora etc and for manual installation you may look into this Linux Installation docs

Authenticating

After installation of the CLI, you will need to authenticate your GitHub account. For authentication, you will have to follow few steps

gh auth login
Enter fullscreen mode Exit fullscreen mode

Alt Text

You will have two options to authenticate, either use browser method or use authentication Token. I will suggest using Browser method as its quick and easy.

Next, you will be asked to choose git protocol, choose https or ssh as per your own convenience.

Alt Text

Voila!! You are all done with the setup!!

For more commands follow this manual

Top comments (0)