1 min read

Git used wrong path of `gh`

The problem

On the Linux server, I have installed homebrew to manage software and installed gh to manage GitHub authorizations. It used to work well. Today, I am trying to use git push to push commits to GitHub there after a while without using it. However, it complained that it cannot find the gh bin.

/home/linuxbrew/.linuxbrew/Cellar/gh/2.14.3/bin/gh auth git-credential get: 1: /home/linuxbrew/.linuxbrew/Cellar/gh/2.14.3/bin/gh: not found

It seems that this is the version issue for gh as brew has updated it to a later version. Yet, somehow the git push is still using the old path.

Solution

gh auth setup-git

Use the above command to set or update git to use GitHub CLI gh as the credential helper for all authenticated hosts. Problem solved.