Gh: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 4: Line 4:
=Overview=
=Overview=
GitHub-specific CLI. Can be used to authenticate, clone repositories, etc.
GitHub-specific CLI. Can be used to authenticate, clone repositories, etc.
 
=Installation=
 
==Mac==
 
<syntaxhighlight lang='bash'>
brew install gh
</syntaxhighlight>
==Linux==
=Authentication=
==Authentication Status==
<syntaxhighlight lang='bash'>
gh auth status --hostname enterprise.internal --show-token
</syntaxhighlight>
==Authenticate with a Personal Access Token==
<syntaxhighlight lang='bash'>
gh auth login --hostname enterprise.internal --with-token < mytoken.txt
</syntaxhighlight>
<syntaxhighlight lang='bash'>
gh auth --hostname github.mycompany.com status
</syntaxhighlight>
==Logout==
<syntaxhighlight lang='bash'>
gh auth --hostname github.mycompany.com logout
</syntaxhighlight>
=Clone Repository=
<syntaxhighlight lang='bash'>
gh repo clone <org>/<repo-name>
</syntaxhighlight>





Revision as of 20:53, 2 May 2022

External

Internal

Overview

GitHub-specific CLI. Can be used to authenticate, clone repositories, etc.

Installation

Mac

brew install gh

Linux

Authentication

Authentication Status

gh auth status --hostname enterprise.internal --show-token

Authenticate with a Personal Access Token

gh auth login --hostname enterprise.internal --with-token < mytoken.txt
gh auth --hostname github.mycompany.com status

Logout

gh auth --hostname github.mycompany.com logout

Clone Repository

gh repo clone <org>/<repo-name>


gh auth <command> [flags]

CORE COMMANDS

 login:       Authenticate with a GitHub host
 logout:      Log out of a GitHub host
 refresh:     Refresh stored authentication credentials
 setup-git:   Configure git to use GitHub CLI as a credential helper
 status:      View authentication status