記錄一次Git報錯

董雷發表於2021-12-08

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

相關文章