go get results in 'terminal prompts disabled' error for github
技术问答
319 人阅读
|
0 人回复
|
2023-09-12
|
我在浏览器里用 Github UI 创建私有仓库 examplesite/myprivaterepo。! D* b* B5 @+ Z" @
然后我转到了我的 go 目录(桌面)和克隆:
( w9 s" `+ F7 Y5 e+ v4 t$ e$ cd $GOPATH$ go get github.com/examplesite/myprivaterepo2 d, I g6 G/ q% K. n
到目前为止还不错。创建文件 scheduler.go,添加到 repo 并推送。
1 p3 k: Y& W; f/ S5 ]$ vim scheduler.go$ git add scheduler.go$ git commit$ git push
' N' C- ~$ N# q* t. ~2 x M 一切正常。但是当我找到一台干净的笔记本电脑,尝试克隆 repo 有错误:6 O7 ^. M( q( y2 k8 w- C4 C
# Now on laptop,which doesn't yet know about the repo$ cd $GOPATH$ go get github.com/examplesite/myprivaterepo# At this point it should ask for my user ID and password ,right? But it doesn't.# Instead,this error occurs:cd .; git clone https://github.com/examplesite/myprivaterepo /Users/tom/go/src/github.com/examplesite/myprivaterepoCloning into '/Users/tom/go/src/github.com/examplesite/myprivaterepo'...fatal: could not read Username for 'https://github.com': terminal prompts disabledpackage github.com/examplesite/myprivaterepo: exit status 128
+ x7 S6 X4 p% ]. y! s+ J2 | 为什么我的笔记本电脑讨厌我自己的回购?我怎样才能让它接受它的命运?非常感谢。
) f% w, l- f! D
( u" v0 B3 n8 N6 ~* ` 解决方案: 9 l) W! r6 |$ Y2 E1 c4 I! B. y
我发现这很有帮助。它解决了我的问题。此命令将允许您的 2FA 执行其操作(省去输入用户名和密码的麻烦):
- _( s% `# k- n5 egit config --global --add url."git@github.com:".insteadOf "https://github.com/": `6 B6 P$ t5 D" X5 t4 b
|
|
|
|
|
|