我設置了一個環境,我可以在本地工作站上將更改推送到「Hub」存儲庫(這是一個遠程),然後更新後的掛鉤會自動更新我的存檔網站,這是「總理」。我這樣做是爲了讓我可以看到當我推送到遠程集線器時,我的更改會自動反映到暫存站點中。Post-Update Git Hook沒有找到目錄
此設置基於this文章。我的服務器是Windows 2012,我在服務器和工作站上都使用MSysGit(Windows 7)。
當我手動執行所有操作時,一切工作正常 - 從我的本地存儲庫推送到集線器,然後手動提取/合併到素數中。我的問題是當我嘗試通過更新後的掛鉤來完成提取/合併時。
當我提交修改我的樞紐,輸出我得到的是:
c:\Code4X\GIT\stage>git push stage master
Counting objects: 11, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 518 bytes, done.
Total 6 (delta 5), reused 0 (delta 0)
remote:
remote: **** Pulling changes into Live [Stage's post-update hook]
remote:
remote: hooks/post-update: line 12: cd: /c/websites/myproject.staging: No
such file or directory
To w:/stage.git
ce1e2ea..93e11f4 master -> master
我的post-update掛鉤是:
#!/bin/sh
echo
echo "**** Pulling changes into Live [Stage's post-update hook]"
echo
cd /c/websites/myproject.staging || exit
unset GIT_DIR
git pull stage master
exec git update-server-info
我能火起來一個bash CMD shell和cd到目錄沒有問題,所以我不知道問題是什麼。
我也試過:
- 包括混帳\ cmd在我的道路
- 包圍我想裁談會在有我的家當點#引號(「)
- 路徑!/ C/PROGRA〜1/git的/ bin/sh的
希望這件事情很明顯。任何想法來的問題是什麼?
我將不得不放棄一下。我想過相對路徑,但我從來沒有嘗試過。我會讓你知道它是怎麼回事。謝謝! –