我正在嘗試構建一個使用私有git存儲庫的go應用程序。我有一個用于我的github帳戶的ssh密鑰,并且在我的.gitconfig文件中有以下內容:[url "https://username:[email protected]"] insteadOf = https://github.com[url "ssh://[email protected]/"] insteadOf = https://github.com/當我執行go測試或去構建時,我被要求輸入密碼。然后我得到一個回復:go: found github.com/x/businesses in github.com/x/businesses v0.0.0-yygo: cmd/main/cmd imports github.com/x/businesses: github.com/x/[email protected]/go.mod: verifying module: github.com/x/[email protected]/go.mod: reading https://sum.golang.org/lookup/github.com/xx/[email protected]: 410 Goneserver response: not found: github.com/x/[email protected]: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in tmp/gopath/pkg/mod/cache/vcs/zz: exit status 128: fatal: could not read Username for 'https://github.com': terminal prompts disabled我嘗試在.gitconfig中刪除頂部而不是Of,沒有理由,然后嘗試一些東西。
1 回答

哆啦的時光機
TA貢獻1779條經驗 獲得超6個贊
你的 git 配置應該看起來與你擁有的東西相似或相似。 [url "[email protected]:"] insteadOf = https://github.com/
然后,您可以通過告訴您使用這樣的私有存儲庫來獲取您的pakege:Go
GOPRIVATE="github.com/your_username_or_org" go get github.com/name_or_org/repo_name
另外,我通常不會在我的SSH密鑰上放一個passprahse,因為每次都輸入它有點煩人,但當然,通過添加它更安全,就像評論中指出的那樣。
- 1 回答
- 0 關注
- 158 瀏覽
添加回答
舉報
0/150
提交
取消