Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> 關於 Linux

Linux SVN post-commit hook failed (exit code 255) 錯誤排除與修正

編輯:關於 Linux

Linux 下配置 SVN 自動更新測試伺服器時,提交後觸發 post-commit hook 失敗,報錯 post-commit hook failed (exit code 255) with no output。核心原因通常是 hook 腳本缺少正確的 exit 碼 或權限不足。

標準修正步驟

  1. 建立 hook 腳本: /usr/svn/baoming/hooks/post-commit(無副檔名)。
  2. 賦予執行權限: chmod 777 /usr/svn/baoming/hooks/post-commit。
  3. 腳本內容(必須包含 exit 0):
#!/bin/sh
WEB="/usr/home/mulu"
SVN="/usr/local/bin/svn"
$SVN update $WEB --username ppkj.net --password ppkj.net || exit 1
exit 0

關鍵點解析

  • || exit 1:SVN 更新失敗時回傳非零碼,讓 SVN 知道 hook 失敗。
  • exit 0:腳本正常結束必須明確回傳 0,否則 SVN 視為 hook 失敗並報出 exit code 255。
  • 腳本首行 #!/bin/sh 必須存在,確保正確解譯器執行。
  • 路徑、帳號密碼請依實際環境調整。

修正後再次提交測試,hook 應正常執行自動更新,不再報錯。

Copyright © Windows教程網 All Rights Reserved