什么是“去获取”的正确方法?一个私人存储库? [英] What's the proper way to "go get" a private repository?
问题描述
我正在寻找获得获取
与私人存储库一起工作的方式,经过多次谷歌尝试。
I'm searching for the way to get go get
work with private repository, after many google try.
第一次尝试
The first try
$ go get -v gitlab.com/secmask/awserver-go
Fetching https://gitlab.com/secmask/awserver-go?go-get=1
https fetch failed.
Fetching http://gitlab.com/secmask/awserver-go?go-get=1
Parsing meta tags from http://gitlab.com/secmask/awserver-go?go-get=1 (status code 200)
import "gitlab.com/secmask/awserver-go": parse http://gitlab.com/secmask/awserver-go?go-get=1: no go-import meta tags
package gitlab.com/secmask/awserver-go: unrecognized import path "gitlab.com/secmask/awserver-go
是的,它没有看到meta标签,因为我不知道如何提供登录信息???
第二次尝试
关注 https://gist.github.com/shurcooL/6927554 。
将配置添加到.gitconfig中
yep, It did not see the meta tags because I could not know how to provide login information???
The Second try
Follow https://gist.github.com/shurcooL/6927554.
Add config to .gitconfig
[url "ssh://git@gitlab.com/"]
insteadOf = https://gitlab.com/
$ go get -v gitlab.com/secmask/awserver-go --> not work
$ go get -v gitlab.com/secmask/awserver-go.git --> work but I got src/gitlab.com/secmask/awserer-go.git
ith .git
扩展名与我的项目名称,我可以将其重命名为原始,但每次都这样做 go get
不是这样好,还有其他的方法吗?
Yes it work but with .git
extension with my project name, I can rename it to original but do it everytime go get
is not so good, is there an otherway?
推荐答案
正确的方法是手动将资源库放在正确的位置。一旦存储库存在,您可以使用 go get -u
来更新软件包,并使用 go install
来安装它。名为
The proper way is to manually put the repository in the right place. Once the repository is there, you can use go get -u
to update the package and go install
to install it. A package named
github.com/secmask/awserver-go
进入
goes into
$GOPATH/src/github.com/secmask/awserver-go
您输入的命令为:
cd $GOPATH/src/github.com/secmask
git clone git@github.com:secmask/awserver-go.git
这篇关于什么是“去获取”的正确方法?一个私人存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!