您的位置 首页 golang

go get配置私有仓库

 $ go get -v github.com/xxxxx/tms
go get github.com/xxxxx/tms: module github.com/xxxxx/tms: git ls-remote -q origin in /Users/admin/go/pkg/mod/cache/vcs/c4819c524980c269dd576230dd8937af8a1b03cd1a424db8b5a3aec9161f8054: exit status 128:
	fatal: could not read Username for '#39;: terminal prompts disabled
Confirm the import path was entered correctly.
If this is a private repository, see #git_https for additional information.

#解决
1、为私有仓库指定域名后,go get拉取此域名下的依赖时,会直接通过git进行
配置go env GOPRIVATE
go env -w GOPRIVATE="github.com/xxxxx/*"

2、使用ssh协议拉取github代码时,可通过配置私钥实现免密登录。而go get是使用https协议下载依赖,那么需要配置git拉取私有仓库时使用ssh
$ vim ~/.gitconfig
新增以下内容
[url "git@github.com:"]
      insteadOf = 
  

文章来源:智云一二三科技

文章标题:go get配置私有仓库

文章地址:https://www.zhihuclub.com/101754.shtml

关于作者: 智云科技

热门文章

网站地图