Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Clavin June
Clavin June

Posted on • Originally published atclavinjune.dev on

     

Go Get Golang Private Module

Sunday Snippet #2 go get golang private module

I assume before fetching golang private module, you already have put your public SSH key on your git repository.

$mkdirexample&&cdexample$go mod init examplego: creating new go.mod: module example# this is my private repo, this attempt will produce error$go get github.com/clavinjune/testing@latestgo get github.com/clavinjune/testing@latest: module github.com/clavinjune/testing: git ls-remote-q originin[redacted]:exitstatus 128:    fatal: could notreadUsernamefor'https://github.com': terminal prompts disabledConfirm the import path was entered correctly.If this is a private repository, see https://golang.org/doc/faq#git_httpsforadditional information.# change the https to ssh, go get will try fetching your private module using your SSH key$git config--global--add url."git@github.com:".insteadOf"https://github.com/"$go get github.com/clavinjune/testing@latestgo get: added github.com/clavinjune/testing v1.0.0# success! But if above method still doesn't work set GOPRIVATE first$goenv-wGOPRIVATE="github.com/clavinjune/*"# then, go get again
Enter fullscreen modeExit fullscreen mode

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

a bunch of perceptrons
  • Location
    Jakarta, Indonesia
  • Joined

More fromClavin June

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp