如何在接收后钩检出期间使`sparse-checkout`有效?

时间:2019-01-29 03:32:28

标签: git

我的系统是带有git 1.8.3的centos 7.4。
基于this post,我在sparse-checkout裸仓库中设置了remoteserver,如下所示:

!README.md
!.scrutinizer.yml
!.idea/*
!.idea_modules/*
/*

我认为许可是正确的:

[root@localhost info]# ls -al
total 8
drwxr-xr-x 2 root root  44 Jan 28 11:17 .
drwxr-xr-x 7 root root 132 Jan 28 11:33 ..
-rw-r--r-- 1 root root 240 Jan 28 14:33 exclude
-rw-r--r-- 1 root root  58 Jan 28 11:17 sparse-checkout

当我git push remoteserver master时,post-receive钩子将运行:
 git --work-tree="$DEPLOY_DIR" --git-dir="$GIT_DIR" checkout -f

问题是:
README.md.scrutinizer.yml仍在结帐。

如何使README.md.scrutinizer.yml不以sparse-checkout中的设置签出?

1 个答案:

答案 0 :(得分:0)

先尝试:

git --work-tree="$DEPLOY_DIR"  --git-dir="$GIT_DIR" config core.sparsecheckout true

然后,您的钩子可以继续进行操作,并使用exclusions you have declared检出应遵守sparsecheckout指令的内容。

但是:Git 1.8.3很古老:请确保和upgrade it first if possible