默认情况下,当在 git 仓库根目录中运行时,它看起来是空的:
git config core.hooksPath
如果我们将git config core.hooksPath更改为git config core.hooksPath myhooks
,那么我的问题是:我们如何将其改回默认设置?我们应该取消设置(如何?),还是应该将其设置为.git/hooks
,就像在git config core.hooksPath .git/hooks
中一样?
默认情况下,当在 git 仓库根目录中运行时,它看起来是空的:
git config core.hooksPath
如果我们将git config core.hooksPath更改为git config core.hooksPath myhooks
,那么我的问题是:我们如何将其改回默认设置?我们应该取消设置(如何?),还是应该将其设置为.git/hooks
,就像在git config core.hooksPath .git/hooks
中一样?
git config --unset core.hooksPath
足以取消设置,这将使Git选择默认选项。git config core.hooksPath .git/hooks
(如果您在非裸存储库中)或git config core.hooksPath hooks
(如果您在裸存储库中)。git-config(1)
:The path can be either absolute or relative. A relative path is taken as relative to the directory where the hooks are run.
来自githooks(5)
:Before Git invokes a hook, it changes its working directory to either $GIT_DIR in a bare repository or the root of the working tree in a non-bare repository.
因此,在非裸存储库中需要.git/hooks
,而在裸存储库中需要hooks
。
git config --unset core.hooksPath
命令吗? - larsks~/.gitconfig
文件中[core]
部分下删除自定义的设置。 - zyy