2016-05-18 29 views
1

是否可以在裸存儲庫中的後接收(或任何其他掛鉤)中移動/重命名文件夾?Git:在郵件接收時移動文件夾

#!/bin/sh 
mv /path/to/worktree/src /path/to/worktree/public 

當我嘗試推到倉庫,我得到一個錯誤:

remote: mv: cannot stat `/path/to/worktree/src': No such file or directory 

我相信,在文件夾中我的本地分支存在。

+1

裸存儲庫沒有工作目錄,這就是爲什麼它被稱爲「裸」。 – kan

+0

哦,當然是的。在'post-receive'後面,我打電話給'git --work-tree =/path/to/worktree/--git-dir =/path/to/repo/checkout -f master'。所以,也許這只是後面調用​​'mv'的問題。 – NinjaFart

回答

2

Later in post-receive I am calling git --work-tree=/path/to/worktree/ --git-dir=/path/to/repo/ checkout -f master
So, perhaps it's just a matter of calling mv right after.

究竟:右後,並且在實際worktree(/path/to/worktree/)而不是當前bare repo。對文件的任何操作都需要在簽出的回購庫中完成,而不是裸回購。

另一種方法是push directly to a non-bare repo,但您的方法更安全(首先更新裸回購,然後在其他地方結帳/更新)。

相關問題