如何设置公共 git 存储库?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/620439/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to setup public git repositories?
提问by alex
I recently tried to setup git repo on a linux box and wasted about 10 hours with absolutely no results. There aren't any problems with compilation or anything like that, it's just configuration issue. 2 hours later I got mercurial to do everything i need:
我最近尝试在 linux 机器上设置 git repo,浪费了大约 10 个小时,但完全没有结果。编译或类似问题没有任何问题,这只是配置问题。2 小时后,我得到了 mercurial 来做我需要的一切:
- public repos
- web ui
- push/pull with per-user permissions (not tied to linux accounts)
- 公共回购
- 网页界面
- 具有每个用户权限的推/拉(不绑定到 linux 帐户)
Everything that I can see about git assumes that you are either just running it locally, using github or already have everything setup. I'm either not looking for the right keywords or there just no or very little info on the subject.
我能看到的关于 git 的一切都假设你要么只是在本地运行它,使用 github,要么已经设置好了一切。我要么没有在寻找正确的关键字,要么没有或几乎没有关于该主题的信息。
I do want to try git, but setting it up is a very discouraging experience. Can anyone point to something useful in these terms?
我确实想尝试 git,但是设置它是一种非常令人沮丧的体验。任何人都可以指出在这些方面有用的东西吗?
thank you!
谢谢你!
采纳答案by VonC
I believe (but I have not tried it yet) that gitosisis the way to go in order to:
Update: 2011, I have actually deployed gitolite
我相信(但我还没有尝试过)gitosis是为了:
更新:2011 年,我实际上已经部署了gitolite
- make hosting
git
repos easier and safer. It - manages multiple repositories under one user account, using SSH keys to identify users.
End users do not need shell accounts on the server, they will talk to one shared account that will not let them run arbitrary commands.
- 使托管存储
git
库更容易、更安全。它 - 在一个用户帐户下管理多个存储库,使用 SSH 密钥来识别用户。
最终用户不需要服务器上的 shell 帐户,他们将与一个不会让他们运行任意命令的共享帐户交谈。
The installation process I recommand is one done from a client post in order to copy the full installation of gitolite on the server:
我推荐的安装过程是从客户端帖子完成的,以便在服务器上复制 gitolite 的完整安装:
(from-client method) install from the client to the server
Remember: gitolite manages authorization, not authentication (SSH): it can be used without SSH, but its natural deployment is through SSH and the forced command mechanism. (like gitosis was, but with many more features)
请记住:gitolite 管理授权,而不是身份验证(SSH):它可以在没有 SSH 的情况下使用,但它的自然部署是通过 SSH 和强制命令机制。(就像 gitosis 一样,但具有更多功能)
Old references for gitosis:
gitosis 的旧参考:
Here is a step-by-step tutorial.
这是一个分步教程。
And then an application of the tutorial: Gitosis — making hosting multiple Git repositories manageable(for Mac) or installing gitosis on Ubuntu
然后是本教程的应用程序:Gitosis — 使托管多个 Git 存储库可管理(适用于 Mac)或在 Ubuntu 上安装 gitosis
Followed by: Adding users to our secure Git setup
Finished with: Git subprojects(since your gitosis server manages all those different git repositories)
完成:Git 子项目(因为您的 gitosis 服务器管理所有这些不同的 git 存储库)
For truly light (cgi server) public Git repositories, you can:
对于真正的轻量级(cgi 服务器)公共 Git 存储库,您可以:
- set up a git server: git-daemon; it will listen on port 9418. By default, it will allow access to any directory that looks like a git directory and contains the magic file git-daemon-export-ok. Passing some directory paths as git-daemon arguments will further restrict the exports to those paths.
You can also run git-daemon as an inetd service; - export with httpplace the newly created bare git repository in a directory that is exported by the web server, and make some adjustments to give web clients some extra information they need
- 设置一个git 服务器:git-daemon;它将侦听端口 9418。默认情况下,它将允许访问任何看起来像 git 目录并包含魔术文件 git-daemon-export-ok 的目录。将一些目录路径作为 git-daemon 参数传递将进一步限制对这些路径的导出。
您还可以将 git-daemon 作为 inetd 服务运行; - export with http将新创建的裸git仓库放在web服务器导出的目录中,并做一些调整,给web客户端一些他们需要的额外信息
Here is how to do it on an Apache server.
以下是如何在Apache 服务器上执行此操作。
The 2010 article "8 ways to share your git repository" mentions all the possibilities to give access to a Git repository.
2010 年的文章“共享 git 存储库的 8 种方法”提到了访问 Git 存储库的所有可能性。