Use Apache to configure the GIT Server

Source: Internet
Author: User
Use Apache to configure the GIT Server
Installation environment
  1. Windows 2003
  2. Apache openlogic-apache-2.2.15-windows-ins-openssl-1
  3. Git-1.8.1.2-preview20130201

Reference resources:

  1. Build an Apache + git server on Windows
  2. Install msysgit + Apache-Git Server
  3. Hosting a git server under Apache on Windows
  4. Apache account and password restrict user access

Although there are already a lot of reference resources, the new users who are not familiar with Apache and git still encounter some problems during installation and use. Record your major problems and sort out related resources.

Limitations: Only git server built in the LAN. If you need to support Internet access, you need to refer to other materials.

Download the Installation File
  1. Msysgit
  2. Apache
  3. Source tree
Installation File
  1. Apache installation by default
  2. Note that some articles on the Internet claim that you need to select Run git from the Windows Command Prompt during installation. I have a reserved opinion on this, because it is also possible not to select this item. But to be cautious, it is better to choose this option.
Configure git

After the installation is complete, the main task is to configure the Apache config file. Find the config file address: C: \ Program Files \ Apache Software Foundation \ apache2.2 \ conf
Append the following content after the config file

  1. The first sentence is the destination folder address of git.
  2. In the second sentence, pay attention to the following spaces and parameter 1. Some articles say that you can specify parameters as needed. For example, if you set the parameter to 2, I have no experiment or knowledge about the principle.
  3. The third sentence mainly refers to the string after scriptaliasmatch and spaces must be on one line.
  4. The git-http-backend.exe is found under the GIT installation folder.
    • If the git-http-backend.exe cannot be executed, the system prompts that the libiconv-2.dll is not found, the file is located in c: \ Program Files \ git \ bin. Copy to c: \ Program Files \ git \ libexec \ Git-core
  5. Note the directory location in <directory>
SetEnv GIT_PROJECT_ROOT D:/Repository
SetEnv GIT_HTTP_EXPORT_ALL 1
ScriptAliasMatch"(?x)^/(.*/(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))$""C:/Program Files/Git/libexec/git-core/git-http-backend.exe/$1"

<Directory"C:/Program Files/Git/libexec/git-core/">
OptionsIndexesFollowSymLinks
AllowOverrideAuthConfig
Order allow,deny
Allowfrom all
</Directory>

After completing the above operations, you have completed the basic configuration of git. You can create a database through the command line.

  1. Create a folder D: reposiotry
  2. Use the command line to enter reposiotry
  3. Run git init -- bare test. Git

After the empty library of test is created, we can use our source tree to obtain the test.

Authorization

After configuring the basic git, You need to configure the authorization. First, you need to add the following content to config:

  • Note that the content after authuserfile is not enclosed by quotation marks.
<Location />
AuthType Basic
AuthName “Repository”
AuthBasicProvider file
AuthUserFile C:/htpasswd/.passwd
Require valid-user
</Location>
  1. Find. passwd and htpassword in c: \ Program Files \ Apache Software Foundation \ apache2.2 \ bin and copy them to C:/htpasswd/
  2. Create a user name and password in either of the following ways:
    1. Create through command line
      1. In the c: \ Program Files \ Apache Software Foundation \ apache2.2 \ bin directory, or set this directory to the environment variable.
      2. Run the htpasswd-CMB htpassword ABC 123456 command to obtain. passwd and htpassword.
      3. For more htpasswd commands, refer to the Apache htpasswd command usage instructions
    2. Generated using online tools
      1. Htpasswd generator-create htpasswd
      2. Test the generated content in. passwd and htpassword.
  3. Restart the server and use the source tree for testing.
Other Learning Resources
  1. Git details series learn Git-related content

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.