windows-subsystem-for-linuxgithub-clilinuxbrew

gh command not found, even after installation


I recently have uninstalled Homebrew, as I don't need it anymore, which I previously have installed Github CLI through. I am using WSL2 to re-install Github CLI using the official provided script.

I get no error messages during installation process, however, when I go to use the gh command, I get the following error:

Terminal output error

It says it can't find it, where which gh clearly shows it is installed on my system, plus the linuxbrew folder doesn't exist anymore.

Any help to solve this issue would be appreciated!

EDIT: Every time I start a new terminal session, this also happens, if it helps debugging my issue.

enter image description here


Solution

  • I found the culprit. This line was located in my ~/.profile file: eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv).

    I just commented it out, and now the gh command is working fine, based off the usr/bin/gh location.