Git更新后挂钩“不是目录”错误

时间:2013-06-08 08:57:43

标签: windows git post-update

我正在尝试在Windows环境中设置git post-update挂钩。这是代码:

#!/bin/sh
cd /c/inetpub/vhosts/mywebsite || exit
unset GIT_DIR
git pull hub master
exec git-update-server-info

当我从shell(sh post-update)运行它时,一切都很好。但推后我有一个错误:

hooks/post-update: line 7: cd: /c/inetpub/vhosts/mywebsite: Not a directory

我做错了什么?

1 个答案:

答案 0 :(得分:0)

您可以尝试使用其他路径,相关路径。例如,您的根路径。

#!/bin/sh
unset GIT_DIR
cd ..
git checkout -f

使用cd ..返回文件夹的根路径。然后,git checkout -f用于在每次更新repo时强制更新工作副本。

相关问题