您的位置:首页 > 运维架构 > Linux

centos 安装git server

2014-06-14 10:55 357 查看
安装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正常。



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: