svn的安裝以及post-commit即時更新網站

來源:互聯網
上載者:User

標籤:style   blog   ar   io   color   os   sp   strong   on   

開幹!詳細的碼!
第一步,不多說了:安裝

yum install subversion 

 



第二步:建立倉庫目錄

mkdir  /home/svn

 



第三步:建立版本庫

svnadmin create  /home/svn/banbenku運行svnsvnsever   -d -r  /home/svn/banbenku

 



第四步:修改版本庫的配置
進入 /home/svn/banbenku/conf  目錄下修改,如下:

[general]anon-access = noneauth-access = writepassword-db = /home/svn/passwd  ##使用者的名字和密碼檔案realm = newguangwang  ##版本庫名

 



第五部:設定使用者名稱以及密碼
進入 /home/svn
vim passwd  建立和編輯passwd檔案,格式以下

[users]xiaonan= 1213456xub = 1234156lao = 1234156

 



第六步:建立鉤子,post-commit檔案
進入/home/svn/banbenku/hooks  
vim post-commit  建立和編輯鉤子檔案,內容如下::

#!/bin/shexport LANG=zh_CN.utf8#Set variableREPOS="$1"REV="$2" SVN=/usr/bin/svn  ##可通過whereis svn得出WEB=/home/wwwroot/newguangwang  ##想要放網站目錄的地方,此處的目錄必須和版本庫名字相同,沒有請建立LOG=/home/auto_svn.log  ##日記檔案 #update the code from the SVN$SVN update $WEB --username xiaonange  --password 123456 2>/home/svn/newguangwang/test.log if [ $? == 0 ];then     echo  "$REPOS" "$REV" >>/home/svn/newguangwang/test.log    echo `date`    echo "##############################"fi

 


第七步:給予post-commit運行許可權 

chmod +x post-commit;

 


此步切記!

第七步:檢出版本庫到網站目錄  

svn  checkout file:///home/svn/banbenku   /home/wwwroot/newguangwang

 


給予 

Ok!跑起來吧



 



svn的安裝以及post-commit即時更新網站

聯繫我們

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