在鱼壳上使用`go`

I am struggling with running go in the fish shell.

A) I followed the installation procedure and installed go as specified in the documentation

However, when I run go version, I am getting a fatal error:

fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

When I initialize the git by git init, I receive another error:

error: pathspec 'version' did not match any file(s) known to git

I have the paths configured in my fish config as follows:

set -gx GOPATH /home/<user>/go
set -gx PATH $PATH /usr/local/bin/go $GOPATH/bin

where /usr/local/bin/go is an output of which go in both bash and fish


Running it like bash -c 'go version', however, works without any problems (even without the git directory).


B) Also tried gofish and dnf to install go, the same results

Any help is greatly appreciated!


Additional info:

  • Fish version: fish, version 3.0.2
  • Operating system: Linux t460s 5.0.13-300.fc30.x86_64 x86_64 GNU/Linux

Could this be some kind of alias that is used instead? The error message is an error from the git binary.

Take a look in your file ~/.config/fish/config.fish and see if you find an alias there. If you do not find anything there look at the files in ~/.config/fish/ and subfolders.

As mentioned by @Dave C and @mbuechmann ... I had an alias set for git checkout. Thanks!