我正在积极开发一个回购程序,并希望添加一个github预提交钩子-我的第一个。
当我cd进入/.git
目录时,我得到了错误fatal: this operation must be run in a work tree
我试过:
git --work-tree=${PWD} checkout branch
rm -rf
git init
GIT_WORK_TREE
env (和echo $GIT_WORK_TREE
以确保设置)H 211H 112
运行git --work-tree=. checkout branch
,并再次克隆H 218G 219
有什么建议吗?我在MacOS蒙特里使用zsh,有时我也使用Sourcetree来管理回购。
谢谢
发布于 2022-03-30 08:51:13
因此,我忽略了错误,将/.git/hooks/pre-commit.sample
移动到/.git/hooks/pre-commit
,并添加了一条回波行(echo "Running git pre-commit"
),以查看它在提交时是否运行。的确如此。看来这事已经解决了。
https://stackoverflow.com/questions/71674072
复制相似问题