標籤:sha gitweb provider ken sicp span star git clone root
安裝
yum -y install httpd git
建立倉庫
mkdir /test && cd /testgit init --bare test.gitchown -R apache:apache /test/test.git
vi /test/test.git/config
[http] receivepack = true
修改http.conf
vi /etc/httpd/conf/httpd.conf
# 設定git所管理的工程的存放目錄SetEnv GIT_PROJECT_ROOT /testSetEnv GIT_HTTP_EXPORT_ALLScriptAlias /test/ /usr/libexec/git-core/git-http-backend/# 對git庫的各種請求,執行git-http-backend.cgiScriptAliasMatch "(?x)^/(.*/(HEAD | \info/refs | objects/(info/[^/]+ | [0-9a-f]{2}/[0-9a-f]{38} | pack/pack-[0-9a-f]{40}\.(pack|idx)) | git-(upload|receive)-pack))$" \/usr/libexec/git-core/git-http-backend/$1ScriptAlias / /usr/share/gitweb/gitweb.cgi#為git的http操作添加認證,認證資訊存在git-auth檔案中,關於此檔案的配#置將會在稍後講解<Location />AuthType BasicAuthName "Git Access"AuthUserFile /var/www/git-authRequire valid-userAuthBasicProvider file</Location>
建立串連
ln -s /test /var/www/test
產生密碼
htpasswd -c git-auth user
啟動
systemctl restart httpd
測試
git clone http://user:[email protected]/test/test.git
centos搭建git http伺服器