Install git version: Git 2.10.0
git access: Basic HTTP-based authentication (non-SSL)
1. Install Apache software:
[email protected] ~]# yum install httpd
Set Apache to run when the server starts:
[email protected] ~]# chkconfig--levels 235 httpd on
2. Install dependent libraries:
[email protected] ~]# Yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel[[email protected] ~]# Yum Install gcc Perl-extutils-makemaker
3. Uninstall the old git version:
[[email protected] ~]# yum remove git
4. Install Git, go to the directory where you need to install git, download git, unzip and compile the installation:
SRC] # TAR-ZVXF Git-2.10.0.tar.gz[[email protected] src]# CD Git-2.10.0[[email protected] git-2.10.0]# make prefix=/usr/local /git All[[email protected] git-2.10.0]# make Prefix=/usr/local/git Install
5. Add the Git directory to path:
git-2.10.0 git-2.10.0] # SOURCE/ETC/BASHRC
After the installation is successful, you can view the git version:
git-2.10.0] # git--versiongit version 2.10.0
6. Create a git repository and initialize it :
git-2.10.0 git-2.10.0] # Cd/home/git/repositories/test.git[[email protected] test.git]# git--bare initinitialized empty git repository in/home /git/repositories/test.git/
7. set up Apache users and user groups for the GIT repository and set permissions:
[Email protected] test.git]# chown-r apache:apache/home/git/repositories/test.git
8.Apache Configuration
Create a new user
[email protected] test.git]# < username >
Note: When assigning users later, this command is:
[Email protected] test.git]# htpasswd-m/etc/httpd/conf.d/git-team.htpasswd <username>
Then enter the password that the user wants to use.
Modify the owner of the git-team.htpasswd file and the owning group
[email protected] test.git]# chown apache:apache/etc/httpd/conf.d/git-team.htpasswd
To set access permissions for a git-team.htpasswd file
chmod 640/etc/httpd/conf.d/git-team.htpasswd
Modifying the Apache configuration file httpd.conf
Vi/etc/httpd/conf/httpd.conf
Move the cursor to the end of the file (shift+g) and add the following:
< virtualhost *:80 > ServerName git.cnblogs.com SetEnv git_http_export_all SetEnv git_project_root/home/git/repositories scriptalias /git//usr/libexec/git-core/git-http-backend/ < location /> AuthType Bas IC AuthName "Git" AUTHUSERFILE/ETC/HTTPD/CONF.D/GIT-TEAM.HTPASSWD Require VA Lid-user </ location > </ virtualhost >
ServerName is the domain name or IP address of the GIT server
/home/git/repositories is the folder where the code inventory is placed
Scriptalias is a CGI program that maps the access path starting with/git/to git git-http-backend
AuthUserFile is the file that validates the user account
Save and exit
Restart Apache to make the settings effective
Service httpd Restart
installation and configuration of 9.gitweb
(1). Install Gitweb
Yum Install Gitweb
(2). Modify Git.conf
Vi/etc/httpd/conf.d/git.conf
Change "Alias/git/var/www/git" to "Alias/gitweb/var/www/git"
(3). Modify Gitweb.conf
Vi/etc/gitweb.conf
Remove the # #our $projectroot = "xxx" and set it to the folder where the Git code library is located, so:
Our $projectroot = "/home/git/repositories";
(4). Access Gitweb with a browser: /HTTP Server IP address or domain name/gitweb
Additional:
The Clone address is:
/HTTP Server IP address/git/test.git
Note that the folder where the Git codebase resides is not configured in this path,/git/has been configured to move to the code base.
This allows each pull, push to enter a user name and password. So to set the username password to the HTTP path, such as:
http://user name password @ server IP address/git/test.git
If the username is an e-mail address, you need to change the e-mail address to%40
http://xxx%40qq.com: password @ server IP address/git/test.git
As for the user name is in Chinese, go directly to the URL code.
In the future if you want to add Git project, directly execute the above steps 6, 7 .
Get!
Centos6.8 build git service HTTP access mode