相关疑难解决方法(0)

post-receive hook中的Git checkout:"不是git存储库'.'"

我有一个非纯仓库在我的服务器(目录/家用/安德鲁/网络和/home/andrew/web/.git),设置receive.denyCurrentBranch忽略和创建,接收后钩:

#!/bin/sh
GIT_WORK_TREE=/home/andrew/web git checkout -f
Run Code Online (Sandbox Code Playgroud)

当我运行sh .git/hooks/post-receive时,一切正常.但是当我从我的电脑上推出时,我收到了这个错误:

remote: fatal: Not a git repository: '.'
Run Code Online (Sandbox Code Playgroud)

有什么办法可以解决这个问题吗?最终无需切换裸仓库?

谢谢

编辑:这是我的新收件后挂钩.为什么在接受的答案中描述了这一点.

echo "\nChecking out $PWD"
GIT_DIR=/home/andrew/web/.git
GIT_WORK_TREE=/home/andrew/web git checkout -f
Run Code Online (Sandbox Code Playgroud)

git

19
推荐指数
1
解决办法
5325
查看次数

标签 统计

git ×1