centos 安裝git server

安裝httpd gitgit

# yum install httpd gitweb

建空倉庫apache

# cd /var/cache/git/vim

# mkdir gittest.git && cd gittest.gitui

# git --bare initrest

Initialized empty Git repository in /var/cache/git/server

# git update-server-infoblog

apache權限ip

# chown -R apache:apache /var/cache/git/it

建git web訪問配置文件

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

SetEnv GIT_PROJECT_ROOT /var/cache/git
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/
<Location /git/>
      AuthType Basic
      AuthName "Git Access"
      AuthUserFile /var/www/passwd.git
      Require valid-user
</Location>

建git用戶

# htpasswd -c /var/www/passwd.git user1
New password:
Re-type new password:
Adding password for user user1

# service httpd restart

 

完成。

 

客戶端clone, pull,push正常。

相關文章
相關標籤/搜索