Control your Github from the command line with the Github CLI

Subscribe to my newsletter and never miss my upcoming articles

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)


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

gh auth login

Creating a repository

This is probably the command I use the most

gh repo create repo_name

List repositories of a user

gh repo list username

View Repository in web

View any repository in web

gh repo view owner/repo_name --web

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

gh repo view --web


List Aliases

gh alias list

Set Alias

gh alias set <alias> <expansion>

Delete Alias

gh alias delete <alias>

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.

No Comments Yet