Poking around with the GitHub CLI

1 minute read

About GitHub CLI

A few months ago the GitHub CLI had their first 1.0 release, you can read more about it on their announcement blog. It promises to make working with GitHub easier. I challenge you to find someone that didn’t mess up their first git push. Anyway, I had been meaning to try it out when it was released but only got around to it recently. I’ve written down my notes.


As expected on my Mac …

brew install gh


One time set up was easy enough.

$ gh auth login

? What account do you want to log into? GitHub.com
- Logging into github.com

? How would you like to authenticate? Login with a web browser

! First copy your one-time code: 13D8-ABCD
- Press Enter to open github.com in your browser...
✓ Authentication complete. Press Enter to continue...

? Choose default git protocol SSH
- gh config set -h github.com git_protocol ssh

✓ Configured git protocol
✓ Logged in as stevemar

auth Type in the auth code

all-set We’re all set!

Using the CLI

Clone a repo

Simply run the command below. Note, that I did need to delete the existing repo I had cloned locally first, then reclone it.

gh repo clone IBM/helm101

Create a new repo

Another one liner with lots of options.

$ gh repo create stevemar/repo-test
? Visibility Public
? This will create 'stevemar/repo-test' in your current directory. Continue?  Yes
✓ Created repository stevemar/repo-test on GitHub
? Create a local project directory for stevemar/repo-test? Yes
Initialized empty Git repository in /Users/stevemar/workspace/temp/repo-test/repo-test/.git/
✓ Initialized repository in './repo-test/'

$ cd repo-test
$ ll
drwxr-xr-x  3 stevemar  staff    96B 11 Jan 13:49 .
drwxr-xr-x  4 stevemar  staff   128B 11 Jan 13:49 ..
drwxr-xr-x  9 stevemar  staff   288B 11 Jan 13:49 .git

new-repo Yay, new repo

Creating an issue

This was fun, much like a git commit message, it popped open my editor.

$ gh issue create

Creating issue in stevemar/repo-test

? Title Create content for the repo
? Body <Received>
? What's next? Submit

Listing issues

The last test I did …

$ gh issue list

Showing 1 of 1 open issue in stevemar/repo-test

#1  Create content for the repo    about 1 minute ago

Final thoughts

You can tell that a lot of love and effort went into this CLI. It’s pretty damn good.