cli: `gh` Command not Being Registered

Whenever I try to run the gh command, Command Prompt says it doesn’t recognise it as a command. PowerShell exibits the same behaviour. (Adding an environment variable named gh and setting the path to C:\Program Files (x86)\GitHub CLI\gh.exe allows PowerShell to use it, but I want to use Command Prompt)

How can I manually register gh as a command? (I also would want to know this so I can set up another tool (charmbracelet/glow) so I could use that too)

Version Information

Software Version
GitHub CLI 1.1.0
Windows 6.1 (Build 7601) (Windows 7 SP1)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 24 (7 by maintainers)

Most upvoted comments

The gh command doesn’t work on powershell or cmd. I installed using the choco install gh and I added C:\Program Files (x86)\GitHub CLI manually to path.

Yes I hv restarted the shell and everything. I am on Windows 10 Pro

yea I removed it and installed it again somehow it works lol 😂

sometimes you just gotta do it again with software 😅

I am having the same issue. I just installed the GitHub CLI with the gh_1.4.0_windows_amd64.msi installer. I manually added C:\Program Files (x86)\GitHub CLI\ to my PATH and still no dice. It does work when I use the full file path, just like this:

gh.exe does work by typing in the full command. So instead of gh auth login, I do "C:\Program Files (x86)\GitHub CLI\gh.exe" auth login. It does work, but it’s just terribly inconvenient. https://github.com/cli/cli/issues/2267#issuecomment-716982387

I’m running Windows 10 Pro x64. I don’t have the option of reinstalling Windows as it’s a work machine.

(I also tried amending the install path, but the installer wouldn’t play ball).

The experience is okay with me! I run into issues all the time, my computer specifically is configured a bit weird so I usually just have to work a bit harder to get things working. gh.exe does work by typing in the full command. So instead of gh auth login, I do "C:\Program Files (x86)\GitHub CLI\gh.exe" auth login. It does work, but it’s just terribly inconvenient.

I’m just going to stick with Git to clone repos for now until I can get this working again. For everything else that I need the GH CLI for, I guess I’ll just type gh.exe’s file path.

I’m actually just doing a reinstall of Windows due to graphics driver problems; so I’ll see if that can help. 😃

For people who haven’t tried it, use the age old “log out and log back in” 😃 Worked for me.