使用go语言与gitolite配合使用

huangapple go评论95阅读模式
英文:

Using go language with gitolite

问题

Does know how to use Google's go languages clever get command with Gitolite?
It works great with Google Code and Github as follows:

> go get code.google.com/p/go.example/hello

or

> go get github.com/alphazero/Go-Redis

But my gitolite access look more like:

> git clone git@mygitolite:myproject

Any suggestions?

英文:

Does know how to use Google's go languages clever get command with Gitolite?
It works great with Google Code and Github as follows:

> go get code.google.com/p/go.example/hello

or

> go get github.com/alphazero/Go-Redis

But my gitolite access look more like:

> git clone git@mygitolite:myproject

Any suggestions?

答案1

得分: 3

这与gitolite无关。Gitolite只是一个**授权层**,它会根据你的用户名接受或拒绝你的git clone/push/pull命令。

如果你可以将一个git仓库声明为go的源代码,你就可以使用它。Gitolite只会检查你是谁,但不会影响该仓库在go中的使用方式。


OP Peter Krnjevic 详细说明了问题

> 关于go的问题是,它从目录结构中提取仓库名称,所以例如:

~/gocode/src/github.com/me/myproject 

> 会自动转换为

git clone github.com/me/myproject. 

> 但是gitolite的名称如何转换为路径呢?

我认为你不需要转换任何东西:如果go能够连接到你的git仓库(GitHub或任何其他托管仓库服务器),gitolite将拦截命令并验证(或拒绝)它。你可以将gitolite插入到ssh上,或者(正如go导入所做的git请求的情况)使用https。

但主要的问题是:

  • gitolite在服务器端

  • 如果你想要轻松地通过go导入访问你的仓库,你应该与Apache服务器一起使用它(例如,使用我的配置),而不是ssh。

英文:

It has nothing to do with gitolite.
Gitolite is just an authorization layer, which will accept or deny your git clone/push/pull command, depending on your username.

If you can declare a git repo as a source for go, you can use it.
Gitolite will just check who you are, but won't otherwise affect how that repo is used with go.


The OP Peter Krnjevic refines the issue:

> The thing with go, is that it pulls the repo name from the directory structure, so for instance:

~/gocode/src/github.com/me/myproject 

> is automagically transformed into

git clone github.com/me/myproject. 

> But how can gitolite names be transformed into a path?

I don't think you need to transform anything: if go is able to contact your git repo (GitHub or any other hosting repo server), gitolite will intercept the command and validate it (or deny it).
You can plug gitolite on top of ssh or (as it is the case with git request done by go import) with https.

But the main point is:

  • gitolite is on the server side

  • you should use it with an Apache sever (like, for instance, with my config), and not ssh, if you want to easily have your repos accessed with go imports.

答案2

得分: 2

我为这个用例编写了一个工具。看看它是否有帮助。

https://github.com/tuxychandru/gorepos

英文:

I wrote a tool just for this use-case. See if it helps.

https://github.com/tuxychandru/gorepos

huangapple
  • 本文由 发表于 2013年2月1日 06:15:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/14636150.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定