我已经开始从事 Golang 项目。使用 make 构建时,出现以下错误:
fatal: could not read Username for 'https://github.com': terminal prompts disabled
Run Code Online (Sandbox Code Playgroud)
为了解决这个问题,我在通过类似的帖子go get results in 'terminal prompts disabled' error for github private repo后做了以下工作:
export GIT_TERMINAL_PROMPT=1
Run Code Online (Sandbox Code Playgroud)
但这并没有解决问题,现在它似乎在无限循环中询问用户名和密码。
我的git配置如下:
$git config --list
remote.origin.url=git@github.com:GolangProjects/Project1.git
Run Code Online (Sandbox Code Playgroud)
即使在这个配置之后,为什么它继续使用 https 而不是 SSH,没有得到任何线索。请帮忙。
Him*_*shu 18
而是创建一个 SSH 密钥,并将其用作 git repo 的默认登录方法。您可以按照此链接在您的机器上创建用于身份验证的 ssh 密钥:
然后使用它来默认您的登录方法使用 ssh 密钥而不是您的凭据:
git config --global url.ssh://git@github.com/.insteadOf https://github.com/
Run Code Online (Sandbox Code Playgroud)