记录一次Git报错

codeup 报错#

git 配置常用命令#

git config --list 
查看配置信息
git config --global --edit
编辑配置

##

数据处理#

错误如下

luwei@luweideMacBook-Pro-2 hotbuyer % go get codeup.aliyun.com/hotmaxx/go-public-structure
go: codeup.aliyun.com/hotmaxx/go-public-structure@v1.8.2: verifying go.mod: codeup.aliyun.com/hotmaxx/go-public-structure@v1.8.2/go.mod: reading https://goproxy.io/sumdb/sum.golang.org/lookup/codeup.aliyun.com/hotmaxx/go-public-structure@v1.8.2: 410 Gone
        server response:
        not found: codeup.aliyun.com/hotmaxx/go-public-structure@v1.8.2: invalid version: git ls-remote -q origin in /tmp/gopath/pkg/mod/cache/vcs/0ec7c552c0c0932e3045d9954557c8866882b2fe60706677c18eaee866fe4039: exit status 128:
                fatal: could not read Username for 'https://codeup.aliyun.com': terminal prompts disabled
        Confirm the import path was entered correctly.
        If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.

打好标记#

记录一次codeup报错

配置账号#

记录一次codeup报错

配置 git#

git config –global url.donglei567@codeup.aliyun.com.insteadOf"">https://donglei4444:donglei567@codeup.aliyun.com.insteadOf codeup.aliyun.com

查看配置#

luwei@luweideMacBook-Pro-2 hotbuyer % git config --list                                      
credential.helper=osxkeychain
user.name=donglei

执行#

go get -u codeup.aliyun.com/hotmaxx/go-public-structure

依然报错

加条件执行 搞定#

go get -insecure codeup.aliyun.com/hotmaxx/go-public-structure

luwei@luweideMacBook-Pro-2 hotbuyer % go get -insecure codeup.aliyun.com/hotmaxx/go-public-structure
go get: -insecure flag is deprecated; see 'go help get' for details
luwei@luweideMacBook-Pro-2 hotbuyer % 

解释#

本来上面的操作基本就解决问题了,但我本人使用的私有 git 仓库 (gitlab 版等) 搭建时没有用 https 协议,是直接用 http 协议,而 go get 默认是请求 https 协议,所以在要加上 - insecure 参数:

本作品采用《CC 协议》,转载必须注明作者和本文链接
good good study day day up