골랑 개인석 찾아가기.
Golang 개인 모듈을 가져오기 전에git 저장소에 공공 SSH 키를 설치했다고 가정합니다.
$ mkdir example && cd example
$ go mod init example
go: creating new go.mod: module example
# this is my private repo, this attempt will produce error
$ go get github.com/clavinjune/testing@latest
go get github.com/clavinjune/testing@latest: module github.com/clavinjune/testing: git ls-remote -q origin in [redacted]: exit status 128:
fatal: could not read Username for 'https://github.com': terminal prompts disabled
Confirm the import path was entered correctly.
If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.
# change the https to ssh, go get will try fetching your private module using your SSH key
$ git config --global --add url."[email protected]:".insteadOf "https://github.com/"
$ go get github.com/clavinjune/testing@latest
go get: added github.com/clavinjune/testing v1.0.0
# success! But if above method still doesn't work set GOPRIVATE first
$ go env -w GOPRIVATE="github.com/clavinjune/*"
# then, go get again
Reference
이 문제에 관하여(골랑 개인석 찾아가기.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/clavinjune/go-get-golang-private-module-4j5e텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)