You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows is not able to recongnise gh as a command ( or as a executable gh.exe ) #4772
When i run the command gh --version it is showing me:
'gh' is not recognized as an internal or external command,
operable program or batch file.
Steps to reproduce the behaviour
make sure you are NOT the local admin on the Windows PC
Open the installer
Click on install
when it prompts for the local admin password enter it
after the installation try to run gh
See error
Logs
PS C:\Users\Advik-B> cd ~
PS C:\Users\Advik-B> cd Griphitor
PS C:\Users\Advik-B\Griphitor> gh repo view --web
gh : The term 'gh' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ gh repo view --web
+ ~~
+ CategoryInfo : ObjectNotFound: (gh:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
@Advik-B The gh installer will put an extra entry to your PATH. In order for that to get picked up, did you restart your terminal window (such as Powershell.exe, Windows Terminal, or Command Prompt) before trying to run gh? If not, then please try that.
@Riffecx Winget as a package manager simply downloads and runs our MSI installer, so if there is a bug in our installer, we should debug it not by switching to a package manager, but by continuing to run the installer directly until we figure out the problem. Thank you
Reacted by aclark225, Rahiq, firefly, KirtiPanchalED, Ivy Xu and Omama K.
@Advik-B The gh installer will put an extra entry to your PATH. In order for that to get picked up, did you restart your terminal window (such as Powershell.exe, Windows Terminal, or Command Prompt) before trying to run gh? If not, then please try that.
@Riffecx Winget as a package manager simply downloads and runs our MSI installer, so if there is a bug in our installer, we should debug it not by switching to a package manager, but by continuing to run the installer directly until we figure out the problem. Thank you
@mislav Yes., I did restart my PC and my terminal. but windows is not able to recognise gh as a command
Even when I do this: in command prompt
where gh
It gives me the error:
INFO: Could not find files for the given pattern(s).
@Advik-B If you go to System Properties > Advanced > Environment Variables and check the Path variable there, does it have any entry with "GitHub CLI" in it? It should have been added by our installer.
If not, you can add one yourself (e.g. add an entry to the path like C:\Program Files (x86)\GitHub CLI), but that still doesn't solve the problem of why the installer didn't add one in the first place. 🤔
@Advik-B If you go to System Properties > Advanced > Environment Variables and check the Path variable there, does it have any entry with "GitHub CLI" in it? It should have been added by our installer.
If not, you can add one yourself (e.g. add an entry to the path like C:\Program Files (x86)\GitHub CLI), but that still doesn't solve the problem of why the installer didn't add one in the first place. 🤔
😞 Looks like I will have stick with git. I hope the installer gets fixed in the future
In the meantime, like @Riffecx suggested, you can give package managers a try. I like Scoop, but winget seems to be becoming better as well (I just could never figure out how to actually install it).
@Advik-B The gh installer will put an extra entry to your PATH. In order for that to get picked up, did you restart your terminal window (such as Powershell.exe, Windows Terminal, or Command Prompt) before trying to run gh? If not, then please try that.
@Riffecx Winget as a package manager simply downloads and runs our MSI installer, so if there is a bug in our installer, we should debug it not by switching to a package manager, but by continuing to run the installer directly until we figure out the problem. Thank you
As someone used to Linux, I didn't realize I couldn't just open a new PowerShell tab but need to open a new window. Since others will be confused by this too, we should update the documentation to ask people to open a new terminal window.
@Advik-B The gh installer will put an extra entry to your PATH. In order for that to get picked up, did you restart your terminal window (such as Powershell.exe, Windows Terminal, or Command Prompt) before trying to run gh? If not, then please try that.
@Riffecx Winget as a package manager simply downloads and runs our MSI installer, so if there is a bug in our installer, we should debug it not by switching to a package manager, but by continuing to run the installer directly until we figure out the problem. Thank you
Thank you for mentioning the 'restart' step.
It helped me fix my gh (not recognizable) issue.
Activity
mislav commentedon Nov 22, 2021
@Advik-B The gh installer will put an extra entry to your PATH. In order for that to get picked up, did you restart your terminal window (such as Powershell.exe, Windows Terminal, or Command Prompt) before trying to run
gh? If not, then please try that.@Riffecx Winget as a package manager simply downloads and runs our MSI installer, so if there is a bug in our installer, we should debug it not by switching to a package manager, but by continuing to run the installer directly until we figure out the problem. Thank you
Advik-B commentedon Nov 23, 2021
@mislav Yes., I did restart my PC and my terminal. but windows is not able to recognise gh as a command
Even when I do this: in command prompt
where ghIt gives me the error:
mislav commentedon Nov 23, 2021
@Advik-B If you go to System Properties > Advanced > Environment Variables and check the
Pathvariable there, does it have any entry with "GitHub CLI" in it? It should have been added by our installer.If not, you can add one yourself (e.g. add an entry to the path like
C:\Program Files (x86)\GitHub CLI), but that still doesn't solve the problem of why the installer didn't add one in the first place. 🤔Advik-B commentedon Nov 24, 2021
😞 Looks like I will have stick with git. I hope the installer gets fixed in the future
mislav commentedon Nov 24, 2021
We are working on a better installer: #4276
In the meantime, like @Riffecx suggested, you can give package managers a try. I like Scoop, but winget seems to be becoming better as well (I just could never figure out how to actually install it).
Closing in favor of the referenced PR
vegerot commentedon Dec 10, 2022
As someone used to Linux, I didn't realize I couldn't just open a new PowerShell tab but need to open a new window. Since others will be confused by this too, we should update the documentation to ask people to open a new terminal window.
Omi98 commentedon Feb 25, 2024
This helped me! Thanks.
Omi98 commentedon Feb 25, 2024
Thank you for mentioning the 'restart' step.
It helped me fix my gh (not recognizable) issue.
ccn1971 commentedon Sep 21, 2024
Hello! I´m unable to run gh workflow list
C:\Users\crist>gh workflow list
unable to find git executable in PATH; please install Git for Windows before retrying
I added the PATH but still not working.
My OS is Windows 11.