使用go get获取私有GitHub仓库时出现"terminal prompts disabled"错误
大家好!我是Go新手,正在尝试在我的项目中引入一个私有GitHub仓库。我的go.mod文件中有以下依赖:
```
require github.com/mycompany/private-repo v0.1.0
```
当我运行`go get github.com/mycompany/private-repo@latest`时,出现以下错误:
```
go get github.com/mycompany/private-repo@latest:
github.com/mycompany/private-repo@v0.1.0:
terminal prompts disabled
Use the 'gitconfig' or 'GIT_TERMINAL_PROMPT' environment variable to enable prompts
```
我已经将SSH密钥添加到我的GitHub账户中,并且可以通过`git clone git@github.com:mycompany/private-repo.git`正常克隆仓库。但Go似乎无法正常工作。我尝试将GOPROXY设置为`direct`,但没有帮助。我使用的是macOS上的Go 1.21。请问该怎么办?这是一个企业项目,只能通过SSH访问。
<<>>
问题原因
出现此错误是因为Go默认使用HTTPS协议访问GitHub仓库,而HTTPS