Gh: Difference between revisions
Jump to navigation
Jump to search
Line 11: | Line 11: | ||
==Linux== | ==Linux== | ||
=Authentication= | =Authentication= | ||
==Configure Git to use | ==Configure Git to Use <tt>gh</tt> as Credential Helper== | ||
<code>gh</code> repository cloning commands, and probably others, will continue to challenge for username and password, unless <code>git</code> is configured to use <code>gh</code> as credential helper: | |||
<syntaxhighlight lang='bash'> | |||
gh auth setup-git [--hostname enterprise.internal] | |||
</syntaxhighlight> | |||
==Authentication Status== | ==Authentication Status== | ||
<syntaxhighlight lang='bash'> | <syntaxhighlight lang='bash'> |
Revision as of 20:57, 2 May 2022
External
Internal
Overview
GitHub-specific CLI. Can be used to authenticate, clone repositories, etc.
Installation
Mac
brew install gh
Linux
Authentication
Configure Git to Use gh as Credential Helper
gh
repository cloning commands, and probably others, will continue to challenge for username and password, unless git
is configured to use gh
as credential helper:
gh auth setup-git [--hostname enterprise.internal]
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>