Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

go

I'm new in go lang. Trying to import a go library using "go get" command but in cmd getting this error:

go: missing Git command. See https://golang.org/s/gogetcmd package github.com/ttacon/chalk: exec: "git": executable file not found in  %PATH% 

My Go Env:

set GOARCH=amd64 set GOBIN= set GOEXE=.exe set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOOS=windows set GOPATH=F:\Works\Go set GORACE= set GOROOT=C:\Go set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64 set GO15VENDOREXPERIMENT=1 set CC=gcc set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 set CXX=g++ set CGO_ENABLED=1 

What's wrong with my Go environment?

like image 563
Yeahia2508 Avatar asked Mar 16 '16 18:03

Yeahia2508


2 Answers

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.

like image 153
T0xicCode Avatar answered Oct 01 '22 00:10

T0xicCode


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 
like image 24
alamin Avatar answered Sep 30 '22 23:09

alamin