程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了go get results in 'terminal prompts disabled' error for github private repo大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决go get results in 'terminal prompts disabled' error for github private repo?

开发过程中遇到go get results in 'terminal prompts disabled' error for github private repo的问题如何解决?下面主要结合日常开发的经验,给出你关于go get results in 'terminal prompts disabled' error for github private repo的解决方法建议,希望对你解决go get results in 'terminal prompts disabled' error for github private repo有所启发或帮助; @H_489_2@我发现这非常有帮助,它解决了我的问题。此命令将允许您的 2FA 执行其操作(并省去您输入用户名和密码的麻烦):

git config --global --add url."git@github.com:".insteadOf "https://github.com/"
@H_489_2@go get 默认禁用“终端提示”。这可以通过设置 git 的环境变量来更改:

env GIT_TERMINAL_PROMPT=1 go get github.com/examplesite/myprivaterepo

解决方法

@H_489_2@我使用浏览器中的 Github UI 创建了私有仓库 examplesite/myprivaterepo。

@H_489_2@然后我转到我的 go 目录(在桌面上)并克隆它:

$ cd $GOPATH
$ go get github.com/examplesite/myprivaterepo
@H_489_2@到现在为止还挺好。创建文件 scheduler.go,添加到 repo 并推送。

$ vim scheduler.go
$ git add scheduler.go
$ git commit
$ git push
@H_489_2@一切正常。但是当我找到一台干净的笔记本电脑并尝试克隆 repo 时,出现错误:

# 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/myprivaterepo
Cloning into '/Users/tom/go/src/github.com/examplesite/myprivaterepo'...
fatal: could not read Username for 'https://github.com': terminal prompts disabled
package github.com/examplesite/myprivaterepo: exit status 128
@H_489_2@为什么我的笔记本电脑讨厌我自己的回购,我怎样才能让它接受它的命运?谢谢。

大佬总结

以上是大佬教程为你收集整理的go get results in 'terminal prompts disabled' error for github private repo全部内容,希望文章能够帮你解决go get results in 'terminal prompts disabled' error for github private repo所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。