2020-02-04 openstack本地git镜像仓库

Git本地镜像仓库创建

  • 安装git httpd
yum install git httpd
  • 创建git本地镜像仓库目录
mkdir /home/git
chown -R apache:apache /home/git
  • 配置httpd
    /etc/httpd/conf/httpd.conf
    在最后一行IncludeOptional conf.d/*.conf的上面添加下面内容:

        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/
        
                AuthType Basic
                AuthName "Git"
                Require all granted
        

  • 重启httpd
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
  • 从github更新项目到本地镜像仓库
git -c http.proxy=http://192.168.1.7:55315 remote update
  • 使用本地镜像仓库
git clone http://192.168.56.201:/git/keystone.git
  • devstack使用
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的上面添加下面内容:

        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/
        
                AuthType Basic
                AuthName "Git"
                AuthUserFile /etc/httpd/conf.d/git-team.htpasswd
                Require valid-user
        

  • 重启httpd
systemctl restart httpd

你可能感兴趣的:(2020-02-04 openstack本地git镜像仓库)