【发布时间】:2021-12-31 09:37:55
【问题描述】:
我有以下项目结构并尝试将默认的 git hooks 路径从 .git/hooks 更改为 .githooks。我发现命令git config core.hooksPath .githooks 对此负责。但是我一直在努力解决 Windows 10 中的相对路径,我需要上 2 次然后指定 .githooks 目录,但是任何 ..\.、../.、"..\." 都不起作用。
也许问题不仅在 Windows 中,而且还有 Git 如何处理配置文件的方式,这个路径将被写入哪里
如何指定这样的路径,例如在 PowerShell 中?
项目目录:
|
└───.githooks <---I want it here
└───.git
│ └───hooks <---by default it's here
已解决: phd 建议使用 git config core.hooksPath ./.githooks 适用于windows
【问题讨论】:
-
在什么情况下
git config core.hooksPath .githooks不起作用?也可以试试git config core.hooksPath ./.githooks -
git config core.hooksPath ./.githooks完美运行。谢谢! -
您知道,在存储库中存储挂钩是不安全的,因为它允许任何可以写入存储库的人执行任意代码。
标签: windows git powershell