centos 安裝git server


安裝httpd git

# yum install httpd git

建空倉庫

# cd /var/cache/git/

# mkdir gittest.git && cd gittest.git

# git --bare init

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

# git update-server-info

apache權限

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

建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正常。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM