Search code examples
govgo

Go Mod Private Repo


So I have a private repo that my main.go imports. I'm getting this error when I do a go build:

cannot find module for path

Do I need to do anything special for a private repo? I have been googling and can't find any good information. It works fine with dep.


Solution

  • Do this

    git config --global --add url."[email protected]:".insteadOf "https://your-repo.com/"
    export GOPRIVATE='your-repo.com'
    

    Make sure your git clone via ssh works.