golang “go get” command showing “go: missing Git command” error

后端 未结 5 1894
栀梦
栀梦 2021-02-01 17:22

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/goge         


        
相关标签:
5条回答
  • 2021-02-01 17:48

    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'
        ...
      }
    }
    
    0 讨论(0)
  • 2021-02-01 17:53

    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.

    0 讨论(0)
  • 2021-02-01 17:56

    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.

    0 讨论(0)
  • 2021-02-01 18:04

    Install git.

    for Ubuntu, you can use the command

    sudo apt-get install git
    
    0 讨论(0)
  • 2021-02-01 18:08

    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
    
    0 讨论(0)
提交回复
热议问题