How to uninstall GitHub CLI on Windows
GitHub CLI stores your login token and settings separately from the program itself, so uninstalling it does not sign you out on its own if you ever ran gh auth login. This guide covers GitHub CLI installed machine-wide from the GitHub.cli winget package.
Quit anything using gh first
Close any terminal running gh commands. Check Task Manager (Ctrl+Shift+Esc) for gh.exe before you uninstall, though it normally exits as soon as a command finishes.
Remove the app with its own uninstaller
Go to Settings › Apps › Installed apps, find GitHub CLI, and choose Uninstall, or run:
winget uninstall --id GitHub.cli
Where the data lives
| Location | What it holds | What to do |
|---|---|---|
Program Files\GitHub CLI |
The gh.exe binary itself |
Removed by the uninstaller |
%APPDATA%\GitHub CLI |
Your login token and settings, documented by GitHub as the config folder gh uses when $env:AppData is set |
Not touched by the uninstaller; back it up or remove it yourself, and run gh auth logout first if you want the token revoked |
This test never ran gh auth login or any other gh command, so %APPDATA%\GitHub CLI was never created and could not be checked.
Check the result
Run these read-only commands after the uninstall finishes, ideally from a new terminal window:
gh --version
winget list --id GitHub.cli
Test-Path "$env:ProgramFiles\GitHub CLI"
Test-Path "$env:APPDATA\GitHub CLI"
gh --versionfailing with "not recognized" means GitHub CLI is gone from your PATH; printing a version means either the uninstall did not finish or another install is still on your machine.- A completed
winget listquery with no match means the package record is gone; a matching row means the uninstall did not finish. Test-Path "$env:ProgramFiles\GitHub CLI"returningFalsemeans the program folder is gone;Truemeans files remain there.Test-Path "$env:APPDATA\GitHub CLI"returningTruemeans a login token or settings are still there; sign out withgh auth logoutfirst if you have not, then remove the folder yourself.
If you installed it with winget
winget uninstall runs the same MSI uninstaller Settings › Apps uses and removes the same program files; it does not touch %APPDATA%\GitHub CLI or sign you out of any account.
Account and subscription
Uninstalling does not sign you out of GitHub or revoke the token gh auth login created. Run gh auth logout before you uninstall if you want to be sure it is revoked, or revoke it from your GitHub account's settings afterward.
What Mole lists
For GitHub CLI installed machine-wide from winget, the uninstall review lists nothing: the MSI uninstaller removes Program Files\GitHub CLI, the machine PATH entry it added and its registry key by itself, so there is nothing left for Mole to offer. Mole also does not show the program folder as a row on its own for this app, because the installer's registry entry does not record an install location; check Program Files\GitHub CLI yourself if you want to confirm it is gone. %APPDATA%\GitHub CLI is not part of this list either way.
What this test covered
Tested with GitHub CLI 2.101.0 installed through winget from the arm64 MSI package, machine scope, elevated. No gh command was ever run, so a signed-in token, its folder, and removing an install that is authenticated were not verified.
