Git Http Server

來源:互聯網
上載者:User
#http://www.wretch.cc/blog/michaeloil/22286355#http://blog.longwin.com.tw/2009/05/build-git-env-over-http-2009/#安裝軟體sudo apt-get install git-coresudo apt-get install apache2#啟用相應模組a2enmod dav_fsa2enmod dav#設定apache2sudo htpasswd -c /etc/apache2/dav_git.passwd dav>New password: 123>Re-type new password: 123>Adding password for user davsudo vim /etc/apache2/sites-available/git.conf<VirtualHost *:80>    ServerAdmin user@example.com    DocumentRoot /var/cache/git    ServerName git.example.com    ErrorLog /var/log/apache2/git-error.log    CustomLog /var/log/apache2/git-access.log combined  

SetEnv GIT_PROJECT_ROOT /var/cache/git/
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias / /usr/lib/git-core/git-http-backend/

<Location "/test.git">    DAV on    AuthType Basic    AuthName "Git"    AuthUserFile /etc/apache2/dav_git.passwd # password filename    Require valid-user    </Location></VirtualHost>#刪除原來監聽80連接埠的預設檔案sudo rm /etc/apache2/sites-enabled/000-default#啟用新的git配置sudo ln -s /etc/apache2/sites-available/git.conf /etc/apache2/sites-enabled/git.conf#重啟sudo /etc/init.d/apache2 restart#設定gitsudo mkdir -p /var/cache/git/project_name.gitcd /var/cache/git/project_name.gitsudo git --bare initsudo git update-server-infosudo cp hooks/post-update.sample hooks/post-updatesudo chown www-data:www-data -R .goodspeed@bogon:/var/cache/git$ sudo rm -r project_name.gitgoodspeed@bogon:/var/cache/git$ cd project_name.git-bash: cd: project_name.git: No such file or directorygoodspeed@bogon:/var/cache/git$ mkdir project_name.gitmkdir: cannot create directory `project_name.git': Permission deniedgoodspeed@bogon:/var/cache/git$ sudo mkdir project_name.gitgoodspeed@bogon:/var/cache/git$ cd project_name.git/goodspeed@bogon:/var/cache/git/project_name.git$ sudo git --bare initInitialized empty Git repository in /var/cache/git/project_name.git/goodspeed@bogon:/var/cache/git/project_name.git$ sudo chown www-data:www-data -R .goodspeed@bogon:/var/cache/git/project_name.git$ sudo git update-server-infogoodspeed@bogon:/var/cache/git/project_name.git$ sudo cp hooks/post-update.sample hooks/post-updategoodspeed@bogon:/var/cache/git/project_name.git$ sudo chown www-data:www-data -R .goodspeed@bogon:/var/cache/git/project_name.git$ llcurl --netrc --location http://127.0.0.1/test.git/HEADcurl --netrc --location -v http://127.0.0.1/test.git/HEAD

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.