Install the HTTP git server on centos

Source: Internet
Author: User

1. Install httpd, git, and gitweb on the server.

 

1 #yum install httpd git git-daemon  gitweb

2. initialize the repository on the server

123 #mkdir -p /data3/gitserver#cd /data3/gitserver# Git init -- bare git_repo # initialize a bare Repository

3. submit the initial file to the bare warehouse

1234567 #cd /tmp#git clone /data3/gitserver/git_repo#cd git_repo#touch MD#git add MD#git commit -m "init readme txt"  MD#git push origin master

 

4. Create a smart HTTP protocol so that you can access the GIT repository using the HTTP protocol.

12 #cd /etc/httpd/conf.d#vim git.conf

Add the following configuration file

12345678910 ScriptAlias /gitserver/ /usr/libexec/git-core/git-http-backend/         <Directory "/usr/libexec/git-core/">  SetEnv GIT_PROJECT_ROOT /data3/gitserver  SetEnv GIT_HTTP_EXPORT_ALL  SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER  Options +ExecCGI  Order allow,deny  Allow from all</Directory>

 

5. Configure gitweb information to access the GIT repository through the web;

1 #vim  /etc/gitweb.conf

Enter the GIT repository path

1234 # Set the path to git projects.  This is an absolute filesystem path which will# be prepended to the project path.#our $projectroot = "/var/lib/git";$projectroot = "/data3/gitserver";

6. Restart httpd

12 #chkconfig httpd on#service httpd start

7. View git Repository

Http: // ip_address/git

8. Clone git Repository

1 git clone http://ip_address/gitserver/git_repo

9. If push fails, perform the following operations on the server:

1234 #git push origin master# If git push fails#cd /data3/git_server/git_repo# git config daemon.receivepack true

 

 

 

If gitweb prompts that the project cannot be found, the permission for the/usr/local/Gerrit/git directory may be insufficient. Configure Gerrit1. Edit the configuration file Vim/data/Gerrit/etc/Gerrit. config and add [gitweb] CGI =/var/www/git/gitweb. cgi2. Restart Gerrit.
Related Article

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.