loading...

go modでプライベートgithub参照の時

dongri profile image D ・1 min read

こんなエラー出たら

go: finding module for package github.com/***/***
go: downloading github.com/***/*** v0.0.0-20200424032624-7ee614f6e303
github.com/***/*** imports
        github.com/***/***/***: github.com/***/***@v0.0.0-20200424032624-7ee614f6e303: verifying module: github.com/***/***@v0.0.0-20200424032624-7ee614f6e303: reading https://sum.golang.org/lookup/github.com/***/***@v0.0.0-20200424032624-7ee614f6e303: 410 Gone
        server response:
        not found: github.com/***/***@v0.0.0-20200424032624-7ee614f6e303: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /tmp/gopath/pkg/mod/cache/vcs/2d253e2ea6ebdb2e3be78af07d3b07b09c565cb0a0efc6a1ac5deb8f6aeca582: exit status 128:
                fatal: could not read Username for 'https://github.com': terminal prompts disabled

以下のように設定

$ vim ~/.gitconfig
[url "git@github.com:"]
    insteadOf = https://github.com/

$ vim ~/.bashrc
export GO111MODULE=on # Go Mobules
export GOSUMDB=off
export GOPROXY=direct

Discussion

pic
Editor guide