windows下svn鉤子實現每次提交更新至web目錄

來源:互聯網
上載者:User

標籤:

目的

找 到SVN Server中的倉庫(Repositories)檔案夾的位置,在相應的專案檔夾中找到hooks檔案夾。在該檔案夾中添加一個post- commit檔案;當有commit動作發生時(提交到SVN Server時)就會執行這個post-commit檔案,在該檔案實現資料的複製、

步驟

1.找到svn伺服器端某個項目倉庫目錄下(本例中服務端已建立一個test項目):

2.在hooks目錄下建立post-commit.bat 檔案,內容如下:

@echo off

SET REPOS=%1
SET REV=%2
SET DIR=%REPOS%/hooks
SET PATH=%PATH%;
SET WORKING_COPY=E:/myweb  //此處是你的項目路徑

svn update %WORKING_COPY% --username tianyl --password 111111    //輸入svn使用者名稱密碼

3.web目錄下一定要用TortoiseSVN checkout出Repositories的代碼

4..還有一個注意問題——Visual SVN Server的許可權,否則可能會出現下列錯誤:
post-commit hook failed (exit code 1) with output:
svn: E155004: Working copy ‘D:/www/Test‘ locked
svn: E200031: sqlite: attempt to write a readonly database
svn: E200031: sqlite: attempt to write a readonly database
svn: run ‘svn cleanup‘ to remove locks (type ‘svn help cleanup‘ for details)
原因是Visual SVN Server服務的執行許可權不夠,不能對指定目錄做讀寫操作。解決辦法,修改Visual SVN Server 
簡單操作 windown下在運行中輸入 services.msc 找到visual svn server 服務 右鍵屬性 登陸面板 設定案頭互動或者管理員權限再試

windows下svn鉤子實現每次提交更新至web目錄

聯繫我們

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