GH-AUTH-SETUP-GIT(1)
π gh-auth-setup-git(1) β like, the git credential-helper glow-up
okay bestie, welcome to gh-auth-setup-git, straight out of the GitHub CLI manual (yes, that's the gh-auth-setup-git(1) girlie β she's in the GitHub CLI manual section, hi π). She's a tiny command with one job and she does it flawlessly.
β¨ NAME β¨
gh-auth-setup-git β set up git with the GitHub CLI. that's it, that's the whole name, and honestly? iconic. π
πΈ SYNOPSIS πΈ
gh auth setup-git [flags]
π¦ DESCRIPTION π¦
so here's the tea, bestie: this command configures git to use the GitHub CLI as a credential helper. and if you're sitting there like "girl what is a credential helper", no worries, there's a whole doc for that over at:
β¨https://git-scm.com/docs/gitcredentialsβ©
now, by default, the GitHub CLI sets itself as the credential helper for all authenticated hosts. and if there are, like, no authenticated hosts at all? the command fails with an error. she's not gonna fake it for you, ngl π
alternatively β and this is the part where it gets cute β you can use the --hostname flag to specify a single host to be configured. and if that host is not authenticated with? yep, the command fails with an error. same energy, different scope. π
π OPTIONS π
-f,--force <--hostname>β forces setup even if the host isn't known. β οΈ this one must be used in conjunction with--hostname, like they're a package deal, fr fr.-h,--hostname <string>β the hostname to configure git for. one host, hand-picked, main character energy. π
β EXIT CODES β
keep these in your notes app, bestie:
0: successful execution β¨1: error π2: command canceled π4: authentication required π
NOTE: specific commands may have additional exit codes. refer to the command's help for more information. don't come for me, that's literally what it says π«Ά
π EXAMPLE π
# Configure git to use GitHub CLI as the credential helper for all authenticated hosts
$ gh auth setup-git
# Configure git to use GitHub CLI as the credential helper for enterprise.internal host
$ gh auth setup-git --hostname enterprise.internal
see? two lines, both slaying, one for everybody and one for enterprise.internal specifically. no cap. π₯
π SEE ALSO π
gh-auth(1) β go read that one next, iykyk π
<div align="center">
~ and that's the vibe check ~ this page is brought to you by GitHub CLI v2.102.0, dated Oct 2026 β mwah, love u, go configure those credential helpers bestie π§π
</div>
π¦ where this page comes from
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- opensuse-leap 16.0: gh 2.102.0-bp160.1.1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms