日期:2014-05-16  浏览次数:20502 次

如何搭建git 服务器

Git on the Server - The Protocols

The Protocols

git 协议

Git can use four major network protocols to transfer data: Local, Secure Shell (SSH), Git, and HTTP. Here we’ll discuss what they are and in what basic circumstances you would want (or not want) to use them. git 可以主要使用四种协议传输数据, 本地 ssh ,git ,http。 在这里,我们将讨论它们是什么以及在什么样的基本情况,你想(或不想)使用他们

It’s important to note that with the exception of the HTTP protocols, all of these require Git to be installed and working on the server. 值得注意的是 除了http 协议外 其他的协议是确保git 顺利安装和工作所必须的。

Local Protocol

本地协议
The most basic is the Local protocol, in which the remote repository is in another directory on disk. This is often used if everyone on your team has access to a shared filesystem such as an NFS mount, or in the less likely case that everyone logs in to the same computer. The latter wouldn’t be ideal, because all your code repository instances would reside on the same computer, making a catastrophic loss much more likely.

最基本的是本地的协议,在远程存储库是在另一个磁盘上的目录。这是经常使用的,如果你的团队中的每个人都可以访问的共享文件系统,如NFS安装,或在不太可能的情况下,每个人都登录到同一台计算机。后者是不理想的,因为所有的代码仓库实例都储存在同一台计算机,使一个灾难性损失的可能性。

If you have a shared mounted filesystem, then you can clone, push to, and pull from a local file-based repository. To clone a repository like this or to add one as a remote to an existing project, use the path to the repository as the URL. For example, to clone a local repository, you can run something like this:

如果你有一个共享挂载的文件系统,那么你可以克隆,推动,和拉从一个本地的基于文件的存储库。为了这样或添加到现有项目中远程克隆一个仓库,使用到资源库中的URL路径。例如,如果要克隆一个本地仓库,你可以运行像这样:

$ git clone /opt/git/project.git

Or you can do this: