Installing & Authenticating the GitHub CLI (gh) for GHES
A how-to for connecting the GitHub CLI to our GitHub Enterprise Server (GHES) instance at github.austin.utexas.edu.
Audience: Users with moderate-to-advanced technical knowledge on macOS or Windows.
Goal: Installghand authenticate it against our enterprise host sogitandghcommands work againstgithub.austin.utexas.edu.
Prerequisites
An account on
github.austin.utexas.edu.Network access to the GHES instance. This requires the UT VPN (or an on-campus connection).
macOS: Terminal, iTerm2, etc.
Windows: PowerShell, Windows Terminal, or Git Bash.
1. Install gh
macOS (Homebrew)
brew install ghVerify:
gh --versionNo Homebrew? Install it from brew.sh, then run the command above.
Windows
Pick one of the following.
winget (recommended, built into Windows 10/11):
winget install --id GitHub.cliScoop:
scoop install ghChocolatey:
choco install ghAfter installing, open a new terminal window (so PATH updates take effect) and verify:
gh --version2. Authenticate to github.austin.utexas.edu
The key detail for enterprise is the --hostname flag. Without it, gh defaults to the public github.com. Point it at our GHES host instead.
Interactive login (recommended)
gh auth login --hostname github.austin.utexas.eduYou'll be prompted through a short wizard:
Protocol for Git operations
HTTPS
SSH
Choosing HTTPS lets
ghalso act as your Git credential helper.
Authenticate Git with your GitHub credentials? → Yes (if prompted).
How would you like to authenticate?
Login with a web browser —
ghshows a one-time code; press Enter, paste the code into the browser page that opens, and approve.Paste an authentication token — supply a Personal Access Token (see below).
Verify
gh auth status --hostname github.austin.utexas.eduYou should see a line confirming you're logged in to github.austin.utexas.edu as your user.
3. Token authentication (alternative / automation)
Browser login isn't always practical (headless servers, CI, scripts). In those cases use a Personal Access Token (PAT).
Create a token
In a browser, go to
https://github.austin.utexas.edu/settings/tokens.Generate a new token with at least the
repo,read:org, andgistscopes (addworkflowif you'll manage GitHub Actions).Copy the token — you won't be able to view it again.
Log in with the token via stdin
macOS / Linux / Git Bash:
echo "YOUR_TOKEN" | gh auth login --hostname github.austin.utexas.edu --with-tokenWindows PowerShell:
"YOUR_TOKEN" | gh auth login --hostname github.austin.utexas.edu --with-tokenPiping the token via
--with-tokenkeeps it out of your shell history and off the command line, which is safer than passing it as an argument.
Environment-variable method (no stored credentials)
For CI runners or ephemeral shells, gh reads the token from the environment instead of the config store. For an enterprise host use GH_ENTERPRISE_TOKEN (and GH_HOST to set the default host):
macOS / Linux / Git Bash:
export GH_HOST=github.austin.utexas.edu
export GH_ENTERPRISE_TOKEN=YOUR_TOKENWindows PowerShell:
$env:GH_HOST = "github.austin.utexas.edu"
$env:GH_ENTERPRISE_TOKEN = "YOUR_TOKEN"
GH_ENTERPRISE_TOKENis the enterprise-specific variable.GH_TOKEN/GITHUB_TOKENapply togithub.com. When both a stored login and an env-var token exist, the environment variable wins.
4. Make it your default host (optional)
If you work almost exclusively against GHES, set it as the default so you can drop the --hostname flag:
export GH_HOST=github.austin.utexas.eduAdd that line to your shell profile (~/.zshrc, ~/.bashrc, or a PowerShell $PROFILE) to make it persistent.
5. Test it end-to-end
# List repos you can access on the enterprise host
gh repo list --hostname github.austin.utexas.edu
# Clone a repo (gh handles auth over HTTPS)
gh repo clone your-org/your-repoIf clones and API calls succeed, you're fully set up.
Troubleshooting
Symptom | Likely cause / fix |
|---|---|
Commands hit | Missing |
| Not connected to the UT VPN (or on-campus network). |
| Open a new terminal so |
Auth succeeds but | Re-run |
Token rejected | Token expired or missing scopes; regenerate with |
Reference
GitHub CLI manual — GitHub Enterprise: https://cli.github.com/manual/#github-enterprise
gh auth loginreference: https://cli.github.com/manual/gh_auth_login