git download:
Website: https://code.google.com/p/msysgit/
Files: Https://msysgit.googlecode.com/files/Git-1.8.4-preview20130916.exe
Apache Download:
Website: http://httpd.apache.org/
Files: http://101.36.96.118/data/4/57/b5/57b5b14df1e1dcffaf5a302c93c57b2d.zip/realuri/apache//httpd/binaries/ Netware/httpd_2.4.6-netware-bin.zip
• The above file installation and configuration process is omitted, this network of data more.
1. Open the Apache httpd.conf configuration file, modify the Deny from all to <directory/>, and add it at the end of the configuration file
1 #2 # Git Server Configured3 #4 Include conf/extra/httpd-git.conf
• This configuration avoids adding too much content to the main configuration file, placing our configuration in a single file.
2. Create a new profile httpd-git.conf in the Apache Conf/extra folder and add the following to the file
1 # Set GIT management library location 2 SETENV git_project_root E:/gitserver # Here's E:/gitserver represents the repository location of the GIT service 3 SETENV git_http_export_all 4 SETENV remote_user= $REDIRECT _remote_user 5 6 # Set up git processing, where the ... ^/git/(. */... Part can also be written ... ^/(. */... 7 # The former means access is accessed using the Http://ServerName/git/Git library, which accesses 8 # under the F:/program using the Http://ServerName/Git library files/git/libexec/g It-core/git-http-backend.exe is a git http handler, in Git. 9 Scriptaliasmatch "(? x) ^/git/(. * * (HEAD | Info/refs | objects/(info/[^/]+ | [0-9a-f] {2}/[0-9a-f]{38} | PACK/PACK-[0-9A-F]{40}. (PACK|IDX)) | git-(upload|receive)-pack) $ "" F:/program files/git/libexec/git-core/git-http-backend.exe/$1 "Ten # Enable Mod_ Rewrite12 rewriteengine On13 # Detect git push15 rewritecond%{query_string} service=git-receive-pack [or,nc]16 Rewrite Cond%{request_uri} ^/*.git/.*/git-receive-pack$ [nc]17 rewriterule. *-[E=authrequired:yes]
Save this file and copy the Bin/libiconv-2.dll file from the Git directory to the libexec\git-core\ in Git, which is the component that Git-http-backend.exe needs to use. Then (Heavy) Start the Apache server.
3. Create the folder Gitserver on the E drive and run the following command
1 git init--bare project name. Git # Build Project Library folder 2 CD project name. Git3 git update-server-info
4. Now use the http://localhost/git/project name. Git path to clone the project, then modify the file, add, Commit, push ...
--The following options are available:
5. Configure access rights
In Apache's conf/extra/httpd-git.conf, add:
1 <Location/git/> # This path and the above scriptaliasmatch need to be consistent 2 authtype Basic3 authname "git Server" 4 AuthUserFile "E:/.htpasses" # This is the password file that needs to be verified 5 Require Valid-user # It is said that if the "Require Valid-user" commented out, there is no need for password authentication, in the intranet time will be very convenient , but this is only allowed for pull, not push. 6 </Location>
Then use the Apache Htpasswd.exe tool to generate the corresponding password file, run the following command
1 htpasswd-bc e:\.htpasses User name password
If you just want to add a user, change the-BC operation to the-B operation. A password verification is required to restart the server before you can manipulate the GIT project.
6. Add Git's Web browsing tool gitphp
Download gitphp:http://www.gitphp.org
Unzip to E:\GitServer (can be a different location) and name the folder gitphp, then add the configuration in Apache conf/extra/httpd-git.conf
1 <ifmodule alias_module> 2 alias/gitphp "E:\GitServer\gitphp" 3 </IfModule> 4 <directory "e:\ gitserver\gitphp "> 5 Options Indexes followsymlinks 6 allowoverride None 7 Order allow,deny 8 allow From all 9 </directory>10 <Location/gitphp/> #这里也是添加密码验证11 authtype Basic12 authname "GIT Server" authuserfile "e:/.htpasses" Require valid-user15 </Location>
Then copy the config/gitphp.conf.php.example into the new file as config/gitphp.conf.php and modify the configuration items in it, for example, what I'm modifying here is:
1 $gitphp _conf[' gitbin '] = ' f:\\progra~1\\git\\bin\\git.exe '; Git.exe file path 2 $gitphp _conf[' projectroot '] = ' e:\\gitserver\\ '; Git project library location (not project folder)
Then restart Apache and browse http://localhost/gitphp using your browser to see Git's web browsing tools.
git configuration on Windows