unix – Git – 带git pull的post-receive hook“无法找到有效的
发布时间:2020-12-15 18:42:26 所属栏目:安全 来源:网络整理
导读:这很奇怪但是在设置git存储库并创建一个post-receive hook时: echo "--initializing hook--"cd ~/websites/testingecho "--prepare update--"git pullecho "--update completed--" 钩子确实运行,但它从来没有设法正确运行git pull: 6bfa32c..71c3d2a maste
这很奇怪但是在设置git存储库并创建一个post-receive hook时:
echo "--initializing hook--" cd ~/websites/testing echo "--prepare update--" git pull echo "--update completed--" 钩子确实运行,但它从来没有设法正确运行git pull: 6bfa32c..71c3d2a master -> master --initializing hook-- --prepare update-- fatal: Not a git repository: '.' Failed to find a valid git directory. --update completed-- 所以我现在问自己,如何通过post-receive使钩子更新克隆? 在这种情况下,运行进程的用户是相同的,它的所有内容都在用户文件夹中,所以我真的不明白…因为如果我手动进入 cd ~/websites/testing git pull 它没有任何问题…… 任何帮助都会非常感激 非常感谢
挂钩正在运行时,GIT_DIR和(如果显式定义了工作树)GIT_WORK_TREE已设置.这意味着您的pull不会与您更改的目录中的第二个存储库一起运行.
试试git –git-dir~ / websites / testing / .git –work-tree~ / websites / testing pull;或者取消设置git的repo-local环境: unset $(git rev-parse --local-env-vars) 有关这些环境变量的更多信息,请参见man 1 git. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |