centos搭建git http伺服器

來源:互聯網
上載者:User

標籤: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伺服器

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.