DEV Community

Kavin Desi Valli
Kavin Desi Valli

Posted on • Originally published at livecode247.com on

Control your Github from the command line with the Github CLI

Want to create a repository, but don't want to go to Github and follow that manual and perhaps long process, every single time.

Use the Official Github CLI. It can do a lot of stuff ranging from creating a repo to closing a PR. I have written down some important commands in this blog post. (Have also linked the docs for the commands)

Login

First, to use some of the commands listed below, you will have to authenticate the CLI by running

gh auth login

Enter fullscreen mode Exit fullscreen mode

Creating a repository

This is probably the command I use the most

gh repo create repo_name

Enter fullscreen mode Exit fullscreen mode

List repositories of a user

gh repo list username

Enter fullscreen mode Exit fullscreen mode

View Repository in web

View any repository in web

gh repo view owner/repo_name --web

Enter fullscreen mode Exit fullscreen mode

View the repository you're currently in (cloned repository)

gh repo view --web

Enter fullscreen mode Exit fullscreen mode

Aliases

List Aliases

gh alias list

Enter fullscreen mode Exit fullscreen mode

Set Alias

gh alias set <alias> <expansion>

Enter fullscreen mode Exit fullscreen mode

Delete Alias

gh alias delete <alias>

Enter fullscreen mode Exit fullscreen mode

These are my most used commands but there are a lot more which can be found on the Github CLI Docs. And most of these commands listed above can also be used with some flags which are listed in the documentations.

Top comments (0)