-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Translate 04-git-server git-daemon #118
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
=== Git Daemon | ||
=== Git 守护进程 | ||
|
||
(((serving repositories, git protocol))) | ||
Next we'll set up a daemon serving repositories over the ``Git'' protocol. This is common choice for fast, unauthenticated access to your Git data. Remember that since it's not an authenticated service, anything you serve over this protocol is public within it's network. | ||
接下来我们将通过 ``Git'' 协议建立一个基于守护进程的仓库。对于快速且无需鉴权的 Git 数据访问,这是一个理想之选。请注意,因为其不包含鉴权服务,任何通过该协议服务的内容将在其网络上公开。 | ||
|
||
If you're running this on a server outside your firewall, it should only be used for projects that are publicly visible to the world. | ||
If the server you're running it on is inside your firewall, you might use it for projects that a large number of people or computers (continuous integration or build servers) have read-only access to, when you don't want to have to add an SSH key for each. | ||
如果运行在防火墙之外的服务器上,它所提供的服务应该只是那些公开的只读项目。 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 它所提供的服务应该只是那些公开的只读项目=》它应该只对那些公开的只读项目服务 |
||
如果是在防火墙之内的服务器上,可用于支撑大量参与人员或自动系统(用于持续集成或编译的主机)只读访问的项目,这样可以省去逐一配置 SSH 公钥的麻烦。 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
如果运行在防火墙之内的服务器上,它可用于 |
||
|
||
In any case, the Git protocol is relatively easy to set up. | ||
Basically, you need to run this command in a daemonized manner:(((git commands, daemon))) | ||
在任何情况下,该 Git 协议都是相对容易设定的。 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 在任何情况下=》无论何时 |
||
通常,你只需要以守护进程的形式运行该命令:(((git commands, daemon))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 冒号改成全角的 |
||
|
||
[source,console] | ||
---- | ||
git daemon --reuseaddr --base-path=/opt/git/ /opt/git/ | ||
---- | ||
|
||
`--reuseaddr` allows the server to restart without waiting for old connections to time out, the `--base-path` option allows people to clone projects without specifying the entire path, and the path at the end tells the Git daemon where to look for repositories to export. | ||
If you're running a firewall, you'll also need to punch a hole in it at port 9418 on the box you're setting this up on. | ||
`--reuseaddr` 允许服务器在无需等待旧连接超时的情况下重启,`--base-path` 选项允许用户在未完全指定路径的条件下克隆项目,结尾的路径将告诉 Git 守护进程从何处寻找仓库并且导出。 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 并且导出=》 |
||
如果有防火墙正在运行,你将需要在其之上开放端口 9418 的通信权限。 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 你将需要在其之上开放端口 9418 的通信权限。 |
||
|
||
You can daemonize this process a number of ways, depending on the operating system you're running. | ||
On an Ubuntu machine, you can use an Upstart script. | ||
So, in the following file | ||
你可以通过许多方式将该进程以守护进程的方式运行,这主要取决于你所使用的操作系统。 | ||
在一台 Ubuntu 机器上,你可以使用一份 Upstart 脚本。 | ||
因此,找到如下文件: | ||
|
||
[source,console] | ||
---- | ||
/etc/event.d/local-git-daemon | ||
---- | ||
|
||
you put this script: | ||
并添加下列脚本内容: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 冒号全角。 |
||
|
||
[source,console] | ||
---- | ||
|
@@ -40,25 +40,25 @@ exec /usr/bin/git daemon \ | |
respawn | ||
---- | ||
|
||
For security reasons, it is strongly encouraged to have this daemon run as a user with read-only permissions to the repositories – you can easily do this by creating a new user 'git-ro' and running the daemon as them. | ||
For the sake of simplicity we'll simply run it as the same 'git' user that Gitosis is running as. | ||
出于安全考虑,强烈建议使用一个对仓库拥有只读权限的用户身份来运行该守护进程 - 你可以创建一个新用户 'git-ro' 并且以该用户身份来运行守护进程。 | ||
为简便起见,我们将像 Gitosis 一样,同样使用 'git' 用户来运行它。 | ||
|
||
When you restart your machine, your Git daemon will start automatically and respawn if it goes down. | ||
To get it running without having to reboot, you can run this: | ||
当你重启机器时,你的 Git 守护进程将会自动启动并且恢复关闭前的状态。 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
并且进程结束会重新运行。 |
||
为了在不重启的情况下直接运行,你可以运行以下命令: | ||
|
||
[source,console] | ||
---- | ||
initctl start local-git-daemon | ||
---- | ||
|
||
On other systems, you may want to use `xinetd`, a script in your `sysvinit` system, or something else – as long as you get that command daemonized and watched somehow. | ||
在其他系统中,你可以使用 `xinetd` ,或 `sysvinit` 系统脚本,或者另外的方式来实现 - 只要你能够将其命令守护进程化并实现监控。 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
你可以使用 |
||
|
||
Next, you have to tell Git which repositories to allow unauthenticated Git server-based access to. You can do this in each repository by creating a file name `git-daemon-export-ok`. | ||
接下来,你需要告诉 Git 哪些项目允许使用基于 Git 的服务在无鉴权状态下访问。你可以在每个仓库下创建一个名为 `git-daemon-export-ok` 的文件来实现。 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
你需要告诉 Git 哪些仓库允许基于服务器的 Git 无鉴权访问。 |
||
|
||
[source,console] | ||
---- | ||
$ cd /path/to/project.git | ||
$ touch git-daemon-export-ok | ||
---- | ||
|
||
The presence of that file tells Git that it's OK to serve this project without authentication. | ||
该文件的存在将使 Git 允许该项目在无鉴权的状态下运行。 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 该文件的存在将使 Git 允许提供无需鉴权的项目访问服务。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
该协议服务的内容=》该协议
管理
的内容There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“鉴权”这里应该和前面一致吧,翻译成“授权”或“验证”?后面几个“鉴权”也一样