GitHub CLI

Advertisement

Do everything from Terminal or Command Prompt with GitHub CLI.

GitHub CLI is Free and open source.

Installation Installation

Image for: #Installation Installation

We can install the GitHub CLI in various ways. I’m using the custom installation for Windows operating system in which I use the MSI file gh_1.0.0_windows_amd64.msi which is now in 5.84 MB.

For other installation process Visit https://github.com/cli/cli#installation

Downlaod the MSI version which is supported by your windows operating system.

  • Visit https://cli.github.com/manual/
GitHub CLI 17
  • Click on gh_1.0.0_windows_amd64.msi to Downlaod
GitHub CLI 18
  • Click on Install
GitHub CLI 19
GitHub CLI 20
GitHub CLI 21
GitHub CLI 22
GitHub CLI 23
GitHub CLI 24
GitHub CLI 25
  • How to confirm Github CLI is installed successfully?
  • Open Terminal or Command Prompt
  • Type gh
    https://i.imgur.com/azDVuRm.png
    Or
  • Type gh --version
    https://i.imgur.com/REnjyxb.png

Top ↑

Authentication Authentication

Image for: #Authentication Authentication
  • Use command gh auth login
  • Select GitHub.com or GitHub Enterprise Server and press enter
GitHub CLI 26
  • Select Login with web browser or Paste an authentication token
GitHub CLI 27
GitHub CLI 28
GitHub CLI 29
  • Enter the token
GitHub CLI 30

313A-1A69

9A85-0C0A

GitHub CLI 31
GitHub CLI 32

Protocol: HTTP / SSH
https://i.imgur.com/u2fZLhX.png

DONE

Top ↑

Image for: #Navigate any Github repository Navigate any Github repository

Here, I have clone the Gutenberg reposotory in my WordPress setup. So, I’m showing few GitHub CLI commands with Gutenberg repo.

Top ↑

PR list PR list

Image for: #PR list PR list

Type gh pr list

Top ↑

Checkout to PR. Checkout to PR.

Image for: #Checkout to PR. Checkout to PR.

Use gh pr checkout <ID>

E.g. gh pr checkout 25419

Top ↑

Issue List Issue List

Image for: #Issue List Issue List

gh issue list

Top ↑

See issue See issue

Image for: #See issue See issue

Use gh issue view <ID>

E.g. gh issue view 25437

See issue on browser with --web flag.

E.g. gh issue view 25437 --web

Top ↑

Create new Repo Create new Repo

Image for: #Create new Repo Create new Repo

mkdir github-cli-example

cd github-cli-example

git init

Use gh repo create

$ gh repo create
? Repository name github-cli-example   
? Repository description 
? Visibility Public                               
? This will create 'github-cli-example' in your current directory. Continue?  Yes   
? Created repository maheshwaghmare/github-cli-example on GitHub
? Added remote https://github.com/maheshwaghmare/github-cli-example.git

Create a README.MD as

ADMIN@ADMIN-PC MINGW64 /c/xampp/htdocs/dev/wp-content/plugins/github-cli-example (master)
$ touch README.md

ADMIN@ADMIN-PC MINGW64 /c/xampp/htdocs/dev/wp-content/plugins/github-cli-example (master)
$ code README.md

I have added the below line in Readme.md file.

# This Repository Created with GitHub CLI command.

Now add changes in github.

ADMIN@ADMIN-PC MINGW64 /c/xampp/htdocs/dev/wp-content/plugins/github-cli-example (master)
$ git add .

Commit changes

ADMIN@ADMIN-PC MINGW64 /c/xampp/htdocs/dev/wp-content/plugins/github-cli-example (master)
$ git commit -m "Initial commit."
[master (root-commit) 2b2938a] Initial commit.
 1 file changed, 1 insertion(+)
 create mode 100644 README.md

Push changes

ADMIN@ADMIN-PC MINGW64 /c/xampp/htdocs/dev/wp-content/plugins/github-cli-example (master)
$ git push origin master
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 266 bytes | 133.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/maheshwaghmare/github-cli-example.git
 * [new branch]      master -> master

Now after visiting to https://github.com/maheshwaghmare/github-cli-example we can see:

Leave a Reply