using the GIT protocol to access git is the most efficient. Although there are also some defects, it is mainly because there is no access permission control, however, you can still consider using the GIT protocol directly when you have high requirements on speed and efficiency in a trusted environment.
note the following when using the GIT protocol to build public repository:
(1) install Git-daemon and make sure that the port (9418) used by Git-daemon allows accept, which can be configured in iptables
(2) create a bare repository, which can be achieved through clone, for example, $ git clone -- bare ~ /Proj. git
(3) create the Git-Daemon-export-OK
file in repository to allow Git-daemon to include the repository in management, run
$ touch proj. git/Git-Daemon-export-OK
(4) added the access control function, to be accurate, read/write can be controlled through $ git config daemon. receivepack true
adds write permission, otherwise, the repository can only be read and not written when using the GIT protocol.
alternatively, it explicitly specifies that receivepack is allowed when Git-daemon is started, for example, Git-daemon -- verbose -- reuseaddr -- Base-Path =/home/Foo -- enable = receive-pack
Note: When you build a system that uses HTTP/HTTPS to access git, you have to do some special work compared to using the GIT protocol:
After repository is created, execute
The update-server-Info command allows the client to find the references and packs of the server where the GIT repository is located.References and packs
Stored in the $ git_dir/info and $ git_object_directory/info directory
Therefore, it is convenient:
(1) run the following command after creating public repository:
$ Git -- bare Update-server-Info
(2) ChangePost-Update
Hook. The GIT hook is automatically executed after the repository is updated.Update-server-Info
Post-Update
. Change samplePost-Update
IsPost-Update
Add execution permission,$ Chmod A + x hooks/post-Update
References:
(1) http://stackoverflow.com/questions/2085402/what-does-git-update-server-info-do
(2) http://book.git-scm.com/4_setting_up_a_public_repository.html
(3) http://www.elpauer.org /? P = 337