go拉取包报错 128

发布时间 2023-12-22 23:37:46作者: youxin

o拉取包报错 128
报错信息
go: gitlab.XXXX/XXX/XXXX: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /XXX/XXXX: exit status 128:
fatal: could not read Username for 'https://gitlab.XXXX.com': terminal prompts disabled
 
从错误信息可以明显地看出来,我们使用私有仓库时通常会配置ssh-pubkey进行鉴权,但是go get使用https而非ssh的方式来下载依赖,从而导致鉴权失败。

解决办法
$ git config --global url."git@gitlab.com:".insteadOf "https://gitlab.com/"
  原文链接:https://blog.csdn.net/fafawf/article/details/118184194