golang "go get" command showing "go: missing Git command" error

The go get fetching of source code is done by using one of the following tools expected to be found on your system either git, svn, hg.

Install git from this link https://git-scm.com/downloads

After installing git you should navigate to the environment variables setting and add the path of git.exe(executable file) which is found in the bin. So the path should look like this "C:\Program Files\Git\bin". Restart your IDE and the command should be working.


go get requires git if any of the packages lives (and is being fetched) from a git repository. For Windows, you can install git from the git website.


Install git.

for Ubuntu, you can use the command

sudo apt-get install git

Locally

Installing git will solve the issue.

  • for mac brew install git
  • for ubuntu sudo apt-get install git
  • for arch linux pacman -S git
  • for windows install git according to the instructions from the git installation page.

In Docker

If you are getting while running in building docker image then you should install git there. [I got this issue while building docker image]

For Example: In my Dockerfile

FROM golang:alpine 
RUN apk add git

Tags:

Go