could not read Username ... terminal prompts disabled

问题描述:

使用goland初始化go 项目加载go.mod时,报错误提示:

fatal: could not read Username ... terminal prompts disabled

问题定位:

由于加载go.mod使用的是go get命令,其中go get 命令用于从远程代码仓库(比如 Github )上下载并安装代码包,由于使用的是内网的仓库的依赖包,所以猜测可能是没有配置git config相关的配置

通过命令git config --list或vi ~/.gitconfig查看git的配置信息

$ git config --list  

        user.name=test

        user.email=test@gmail.com

        .....          

解决方案:

添加用户名或密码配置或修改为ssh访问仓库

1. 修改配置文件~/.gitconfig, 添加配置信息

[user]
# Please adapt and uncomment the following lines:
    name = test
    email = test@gmail.com  

[url "ssh://git@github.com:"]
    insteadOf = https://github.com/

2. 直接使用git config配置

git config --global user.name "test"  

git config --global user.email test@gmail.com  

git config --global --add url."git@github.com:".insteadOf "https://github.com/"

3. 修改GIT_TERMINAL_PROMPT配置

export GIT_TERMINAL_PROMPT=1

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值