Git本地镜像仓库创建
yum install git httpd
mkdir /home/git
chown -R apache:apache /home/git
- 配置httpd
/etc/httpd/conf/httpd.conf
在最后一行IncludeOptional conf.d/*.conf的上面添加下面内容:
<VirtualHost *:80>
ServerName 192.168.56.201
SetEnv GIT_HTTP_EXPORT_ALL
SetEnv GIT_PROJECT_ROOT /home/git
ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/
<Location />
AuthType Basic
AuthName "Git"
Require all granted
</Location>
</VirtualHost>
systemctl restart httpd
- 从github克隆项目到本地镜像仓库目录,以keystone为例
cd /home/git
git clone --mirror -c http.proxy=http://192.168.1.7:55315 https://opendev.org/openstack/keystone
git -c http.proxy=http://192.168.1.7:55315 remote update
git clone http://192.168.56.201:/git/keystone.git
local.conf
GIT_BASE
NOVNC_REPO
账号管理
\#testuser为账户名 可以随意定义
htpasswd -m -c /etc/httpd/conf.d/git-team.htpasswd user1
htpasswd -m -c /etc/httpd/conf.d/git-team.htpasswd user2
\#修改git-team.htpasswd文件的所有者与所属群组
chown apache:apache /etc/httpd/conf.d/git-team.htpasswd
\#设置git-team.htpasswd文件的访问权限
chmod 640 /etc/httpd/conf.d/git-team.htpasswd
- 配置httpd
/etc/httpd/conf/httpd.conf
在最后一行IncludeOptional conf.d/*.conf的上面添加下面内容:
<VirtualHost *:80>
ServerName 192.168.56.201
SetEnv GIT_HTTP_EXPORT_ALL
SetEnv GIT_PROJECT_ROOT /home/git
ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/
<Location />
AuthType Basic
AuthName "Git"
AuthUserFile /etc/httpd/conf.d/git-team.htpasswd
Require valid-user
</Location>
</VirtualHost>
systemctl restart httpd