我从浏览器使用Github UI创建了私有仓库examplesite / myprivaterepo。
然后我转到我的go目录(在桌面上)并将其克隆:
$ cd $GOPATH $ go get github.com/examplesite/myprivaterepo
到目前为止,一切都很好。创建了文件scheduler.go,将其添加到repo中并进行了推送。
$ vim scheduler.go $ git add scheduler.go $ git commit $ git push
一切都很好。但是,当我去一台干净的笔记本电脑尝试克隆存储库时,出现了一个错误:
# 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
为什么笔记本电脑讨厌自己的仓库,我如何才能接受笔记本电脑的命运?谢谢。
go get默认禁用“终端提示”。可以通过设置一个环境变量git来改变它:
env GIT_TERMINAL_PROMPT=1 go get github.com/examplesite/myprivaterepo