去github私人回购的'终端提示禁用'错误结果 [英] go get results in 'terminal prompts disabled' error for github private repo

查看:729
本文介绍了去github私人回购的'终端提示禁用'错误结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

然后,我去了我的go目录(在桌面上)并克隆它:

我使用Github用户界面创建了私人repo examplesite / myprivaterepo。

  $ cd $ GOPATH 
$ go get github.com/examplesite/myprivaterepo

到目前为止这么好。创建文件scheduler.go,添加到回购,并推送。

  $ vim scheduler.go 
$ git add scheduler.go
$ git commit
$ git push

Everythng的确定。但是,当我去一台干净的笔记本电脑,并试图克隆回购,我得到一个错误:

 #现在在笔记本电脑上,其中还不知道回购
$ cd $ gopath
$ go get github.com/examplesite/myprivaterepo
#此时它应该询问我的用户ID和密码,对不对?但事实并非如此。
#相反,发生此错误:
cd。; git clone https://github.com/examplesite/myprivaterepo /Users/tom/go/src/github.com/examplesite/myprivaterepo
克隆到'/Users/tom/go/src/github.com/examplesite / myprivaterepo'...
致命:无法读取'https://github.com'的用户名:终端提示已禁用
包github.com/examplesite/myprivaterepo:退出状态128

为什么我的笔记本电脑讨厌我自己的回购,我怎么才能让它接受它的命运?感谢。

解决方案

默认情况下,禁用终端提示符。这可以通过设置git的env来改变:

  env GIT_TERMINAL_PROMPT = 1 go获取xxxx 


I created the private repo examplesite/myprivaterepo using the Github UI from my browser.

Then I went to my go directory (on the desktop) and cloned it:

$ cd $GOPATH
$ go get github.com/examplesite/myprivaterepo

So far so good. Created the file scheduler.go, added to repo, and pushed.

$ vim scheduler.go
$ git add scheduler.go
$ git commit
$ git push

Everythng's OK. But when I went to a clean laptop and tried to clone the repo, I got an error:

# 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

Why is my laptop hating on my own repo and how can I get it to accept its fate? Thanks.

解决方案

go get disable "terminal prompt" by default. This can be changed by set the env of git:

env GIT_TERMINAL_PROMPT=1 go get xxxx

这篇关于去github私人回购的'终端提示禁用'错误结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆