Installing GitHub CLI on Windows + Chocolatey Troubleshooting and Cleanup
Installing GitHub CLI on Windows + Chocolatey Troubleshooting and Cleanup
Overview
This guide walks through a clean installation of GitHub CLI (gh) on Windows, especially if an earlier Chocolatey-based install was interrupted or partially completed.
If you started a choco install without administrator privileges and had to stop partway through, Chocolatey may have left behind a partial install state. This guide shows you how to clean that up safely, install GitHub CLI using a cleaner method, and authenticate it properly.
When this guide is useful
Use this guide if:
- you attempted to install GitHub CLI with Chocolatey
- the install failed or was interrupted
- you were not running PowerShell as Administrator
ghis now partially installed or behaving inconsistently- you want a cleaner install path using
wingetor the official installer
Part A — Clean up the partial Chocolatey install
If the install was aborted and exited abnormally, the goal is simply to remove any half-installed gh files before reinstalling.
1. Check whether gh exists anywhere
Open PowerShell. A normal session is fine for this check.
where gh
What to look for:
- If nothing is returned, that is a good sign. Move on to Part B.
- If a path is returned, make note of it. We will remove the leftover files next.
2. Check the Chocolatey lib folder
Run:
Get-ChildItem C:\ProgramData\chocolatey\lib
If you see a folder named gh, remove it with:
Remove-Item -Recurse -Force C:\ProgramData\chocolatey\lib\gh
This clears the partially installed package files.
3. Check the Chocolatey bin shims
Run:
Get-ChildItem C:\ProgramData\chocolatey\bin | findstr gh
If you see a leftover shim such as:
gh.exe
remove it with:
Remove-Item C:\ProgramData\chocolatey\bin\gh.exe
This removes the executable shortcut Chocolatey may have left behind.
4. Restart your terminal
Close and reopen PowerShell or your terminal after cleanup.
This helps clear any cached PATH state and ensures the shell is no longer holding onto stale command references.
At this point, your Chocolatey-based GitHub CLI install should be cleanly removed.
Part B — Install GitHub CLI the clean way
Once the partial install is gone, reinstall gh using one of the following methods.
Option 1 — Install with winget (recommended)
This is usually the cleanest option on modern Windows systems.
Open PowerShell as Administrator and run:
winget install --id GitHub.cli
Why this is a strong option:
- it handles PATH configuration cleanly
- it avoids the partial-state issues that sometimes happen with interrupted package installs
- it is a straightforward and well-supported installation path
After installation, verify it worked:
gh --version
If you see the installed version returned, GitHub CLI is ready.
Option 2 — Install using the official MSI
If winget gives you trouble for any reason, the official GitHub CLI installer is also a solid choice.
Steps:
- Go to the GitHub CLI Download Page
- Download the Windows 64-bit installer
- Run the
.msi - Keep the default settings, especially any PATH-related option
- Restart your terminal after installation
Then verify:
gh --version
Part C — Authenticate GitHub CLI
Once gh is installed, you will need to authenticate it.
Run:
gh auth login
You will be prompted to choose how you want to connect GitHub CLI to your account.
Select:
GitHub.com
Then choose:
HTTPS
Then choose:
Authenticate via browser
This will:
- open your browser
- prompt you to authorize GitHub CLI
- return you to the terminal once authentication is complete
You can place your screenshot here:

After selecting Authorize, you should be returned to the terminal fully authenticated.
Why this authentication step matters
GitHub CLI usually requests access to the areas it needs in order to function properly, such as:
- repositories (public and private)
- workflows
- gists
- organization read access
These permissions allow gh to do practical development work like:
- reading repositories
- creating pull requests
- checking workflow runs
- interacting with GitHub Actions
- working across personal and organization repos
Part D — Confirm authentication status
After logging in, verify everything by running:
gh auth status
You should see output similar to:
github.com
✓ Logged in to github.com account DataEden (keyring)
- Active account: true
- Git operations protocol: https
- Token: gh_************************************
- Token scopes: 'gist', 'read:org', 'repo', 'workflow'
If you see output like this, your GitHub CLI installation and authentication are working correctly.
Final Notes
A partial Chocolatey install is not uncommon if the command was started without elevation and then interrupted. The important thing is to clean up the leftover gh files before reinstalling.
For most Windows users, winget or the official MSI will be the simplest and most reliable path forward.
Once installed and authenticated, GitHub CLI becomes a very useful tool for working with repositories, pull requests, issues, and GitHub Actions directly from the terminal.