有没有办法诊断 git init --bare 不创建特定目录的原因?

Is there a way to diagnose why git init --bare doesn't create specific directories?

我正在尝试 运行 Gitolite 我的 LEDE-Project 路由器。我已按照说明 provided here 成功地将必要的依赖项安装到我的路由器上。我的路由器报告 Git 版本 2.11.0,我 运行 正在使用的计算机也是如此。 LEDE-Project 和 OpenWRT can be found here 上 Git 的软件包,因为他们正在共享这些存储库。

当我以 Gitolite 方式创建新存储库时,我收到类似这样的错误消息:

2017-03-06.03:11:23 28046 die could not symlink /root/.gitolite/hooks/common/update to gitolite-admin.git/hooks<> at /root/gitolite/src/lib/Gitolite/Conf/Store.pm line 368.<>

经过一夜安眠,我最终找到了 this specific mailing list post 的原因,这表明 git init --bare 没有生成正确的目录。

Try "git init --bare" in an empty directory and tell me if you see a .git/hooks directory in it.

Assuming you don't, you'll have to fix that somehow. Gitolite expects a 'git init --bare' to create a hooks directory.

似乎是一个合理的假设。我的机器做的很好。

git init --bare foo
Initialized empty Git repository in /home/makoto/workspace/foo/foo/
cd ~/foo
ls -la
drwxrwxr-x 7 makoto makoto 4096 Mar  6 13:15 .
drwxrwxr-x 3 makoto makoto 4096 Mar  6 13:15 ..
drwxrwxr-x 2 makoto makoto 4096 Mar  6 13:15 branches
-rw-rw-r-- 1 makoto makoto   66 Mar  6 13:15 config
-rw-rw-r-- 1 makoto makoto   73 Mar  6 13:15 description
-rw-rw-r-- 1 makoto makoto   23 Mar  6 13:15 HEAD
drwxrwxr-x 2 makoto makoto 4096 Mar  6 13:15 hooks
drwxrwxr-x 2 makoto makoto 4096 Mar  6 13:15 info
drwxrwxr-x 4 makoto makoto 4096 Mar  6 13:15 objects
drwxrwxr-x 4 makoto makoto 4096 Mar  6 13:15 refs

在我的路由器上...没那么多。

git init --bare foo
Initialized empty Git repository in /root/foo/
cd foo/
ls -la
drwxr-xr-x    4 root     root          4096 Mar  6 13:21 .
drwxr-xr-x    1 root     root          4096 Mar  6 13:21 ..
-rw-r--r--    1 root     root            23 Mar  6 13:21 HEAD
-rw-r--r--    1 root     root            66 Mar  6 13:21 config
drwxr-xr-x    4 root     root          4096 Mar  6 13:21 objects
drwxr-xr-x    4 root     root          4096 Mar  6 13:21 refs

就 Gitolite 而言,问题是 hooks/ 文件夹不存在。不过我想不通为什么会这样。

git init --bare 为 运行 时,有没有办法让我诊断创建了哪些文件夹?我觉得如果我能弄清楚当命令是 运行.

时实际执行的是什么,我就能弄清楚其余的事情

好像在您的服务器上,template used for creating a new repo 的内容不完整(即没有钩子)

该模板文件夹位于 <git>/share/git-core/templates<git> 是安装文件夹(在 Windows ./mingw64/share/git-core/templates、Linux、/usr/share/git-core/templates)

由于安全原因不想在其上执行任何挂钩的服务器可能故意缺少挂钩。 (例如,您不能将挂钩添加到 GitHub 裸仓库)