惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
T
Troy Hunt's Blog
P
Proofpoint News Feed
H
Help Net Security
博客园 - 叶小钗
N
Netflix TechBlog - Medium
F
Full Disclosure
Vercel News
Vercel News
C
Cyber Attacks, Cyber Crime and Cyber Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
GbyAI
GbyAI
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 【当耐特】
Martin Fowler
Martin Fowler
V
V2EX
Latest news
Latest news
L
LangChain Blog
The Register - Security
The Register - Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
Schneier on Security
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
N
News and Events Feed by Topic
M
MIT News - Artificial intelligence
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
The Exploit Database - CXSecurity.com
Microsoft Security Blog
Microsoft Security Blog
S
Secure Thoughts
A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
T
The Blog of Author Tim Ferriss
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Spread Privacy
Spread Privacy
S
Securelist
Forbes - Security
Forbes - Security
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
V
Vulnerabilities – Threatpost
MyScale Blog
MyScale Blog
G
Google Developers Blog
L
Lohrmann on Cybersecurity
博客园 - Franky
T
Tor Project blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
V
Visual Studio Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Google DeepMind News
Google DeepMind News
F
Fortinet All Blogs
Y
Y Combinator Blog

博客园 - Lion

如何使用Solidity和Hardhat构建你自己的NFT以及NFT交易市场 如何将 ERC20 代币在一次交易中发送到多个地址? ROS+LEDE最强上网软路由 Flume1.9.0的安装、部署、简单应用(含分布式、与Hadoop3.1.2、Hbase1.4.9的案例) 通过 Sqoop1.4.7 将 Mysql5.7、Hive2.3.4、Hbase1.4.9 之间的数据导入导出 Hadoop 3.1.2(HA)+Zookeeper3.4.13+Hbase1.4.9(HA)+Hive2.3.4+Spark2.4.0(HA)高可用集群搭建 Centos7 二进制安装 Kubernetes 1.13 - Lion Centos7 使用 kubeadm 安装Kubernetes 1.13.3 - Lion Nginx设置Https反向代理,指向Docker Gitlab11.3.9 Https服务 - Lion Docker 创建 Bamboo6.7.1 以及与 Crowd3.3.2 实现 SSO 单点登录 GitLab11.3.9 使用 Crowd3.3.2 的帐号实现 SSO 单点登录,以及GitLab配置腾讯企业邮箱 - Lion Docker 创建 Crucible4.6.1 以及与 Crowd3.3.2 实现 SSO 单点登录 Truffle 4.0、Geth 1.7.2、TestRPC在私有链上搭建智能合约 Go-Ethereum 1.7.2 结合 Mist 0.9.2 实现众筹合约的实例 Go-Ethereum 1.7.2 结合 Mist 0.9.2 实现代币智能合约的实例 以太坊智能合约 Solidity 的常用数据类型介绍 - Lion 使用 Browser-solidity 在 Go-Ethereum1.7.2 上进行简单的智能合约部署 - Lion 使用 Go-Ethereum 1.7.2搭建以太坊私有链 cAdvisor0.24.1+InfluxDB0.13+Grafana4.0.2搭建Docker1.12.3 Swarm集群性能监控平台
go get获取gitlab私有仓库的代码
Lion · 2019-02-20 · via 博客园 - Lion

目录

1、Gitlab的搭建

在上一篇文章中,已经介绍了如何搭建Gitlab Https服务<Nginx设置Https反向代理,指向Docker Gitlab11.3.9 Https服务>

2、如何通过go get,获取Gitlab的代码

$GOROOT/src/cmd/go/internal/get/vcs.go的源码中可以看到,大概在997行左右 ,go get还是使用GIT获取代码的。

// vcsPaths defines the meaning of import paths referring to
// commonly-used VCS hosting sites (github.com/user/dir)
// and import paths referring to a fully-qualified importPath
// containing a VCS type (foo.com/repo.git/dir)
var vcsPaths = []*vcsPath{
	// Github
	{
		prefix: "github.com/",
		re:     `^(?P<root>github\.com/[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+)(/[\p{L}0-9_.\-]+)*$`,
		vcs:    "git",
		repo:   "https://{root}",
		check:  noVCSSuffix,
	},

	// Bitbucket
	{
		prefix: "bitbucket.org/",
		re:     `^(?P<root>bitbucket\.org/(?P<bitname>[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+))(/[A-Za-z0-9_.\-]+)*$`,
		repo:   "https://{root}",
		check:  bitbucketVCS,
	},

	// IBM DevOps Services (JazzHub)
	{
		prefix: "hub.jazz.net/git/",
		re:     `^(?P<root>hub\.jazz\.net/git/[a-z0-9]+/[A-Za-z0-9_.\-]+)(/[A-Za-z0-9_.\-]+)*$`,
		vcs:    "git",
		repo:   "https://{root}",
		check:  noVCSSuffix,
	},

	// Git at Apache
	{
		prefix: "git.apache.org/",
		re:     `^(?P<root>git\.apache\.org/[a-z0-9_.\-]+\.git)(/[A-Za-z0-9_.\-]+)*$`,
		vcs:    "git",
		repo:   "https://{root}",
	},

	// Git at OpenStack
	{
		prefix: "git.openstack.org/",
		re:     `^(?P<root>git\.openstack\.org/[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+)(\.git)?(/[A-Za-z0-9_.\-]+)*$`,
		vcs:    "git",
		repo:   "https://{root}",
	},

	// chiselapp.com for fossil
	{
		prefix: "chiselapp.com/",
		re:     `^(?P<root>chiselapp\.com/user/[A-Za-z0-9]+/repository/[A-Za-z0-9_.\-]+)$`,
		vcs:    "fossil",
		repo:   "https://{root}",
	},

	// General syntax for any server.
	// Must be last.
	{
		re:   `^(?P<root>(?P<repo>([a-z0-9.\-]+\.)+[a-z0-9.\-]+(:[0-9]+)?(/~?[A-Za-z0-9_.\-]+)+?)\.(?P<vcs>bzr|fossil|git|hg|svn))(/~?[A-Za-z0-9_.\-]+)*$`,
		ping: true,
	},
}

如果是 http 服务,可以通过使用-insecure选项获取:

> go get -insecure  mygitlab.com/user/repo

但每次要输入密码比较麻烦,不过go提供了https->ssh的映射,执行如下命令即可,其中lion是你的帐号:

> git config --global url."git@gitlab-ce.mshk.top:".insteadOf "https://lion@gitlab-ce.mshk.top/"

配置好的文件在~/.gitconfig文件中,执行cat ~/.gitconfig可以 看到以下内容:

[url "git@gitlab-ce.mshk.too:"]
	insteadOf = https://lion@gitlab-ce.mshk.top/

获取后的效果如下:
mshk.top


博文作者:迦壹
博客地址:go get获取gitlab私有仓库的代码
转载声明:可以转载, 但必须以超链接形式标明文章原始出处和作者信息及版权声明,谢谢合作!
  
假设您认为这篇文章对您有帮助,可以通过以下方式进行捐赠,谢谢!
向陌上花开捐赠
比特币地址:1KdgydfKMcFVpicj5w4vyn3T88dwjBst6Y
以太坊地址:0xbB0a92d634D7b9Ac69079ed0e521CC2e0a97c420