Precautions for setting up git public repository

Source: Internet
Author: User

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 packsStored 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-UpdateHook. The GIT hook is automatically executed after the repository is updated.Update-server-Info
Post-Update. Change samplePost-Update
IsPost-UpdateAdd 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.