Reputation: 7926
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?
Upvotes: 34
Views: 101443
Reputation: 1114
If you're running this as a Jenkins pipeline script, start your Docker image like:
node('docker') {
docker.image('golang:1.14rc1-alpine3.11').inside(' -u 0') {
sh 'apk add curl'
...
}
}
Upvotes: 1
Reputation: 2487
Installing git will solve the issue.
brew install git
sudo apt-get install git
pacman -S git
git installation page
.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
Upvotes: 39
Reputation: 1178
Install git.
for Ubuntu, you can use the command
sudo apt-get install git
Upvotes: 3
Reputation: 61
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.
Upvotes: 6
Reputation: 4931
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.
Upvotes: 44