Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

gitolite

I'm attempting to run Gitolite on my LEDE-Project router. I've followed the instructions provided here to satisfactorily install the necessary dependencies onto my router. My router reports Git version 2.11.0, as does the computer I'm running this on. The package for Git on LEDE-Project and OpenWRT can be found here, as they're sharing those repos.

When I create a new repository in the Gitolite way, I get an error message similar to this:

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.<>

After a good nights' sleep, I eventually worked the cause of this down to this specific mailing list post, which suggested that git init --bare was not producing the right directories.

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.

Seems like a reasonable assumption. My machine does this just fine.

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

On my router...not so much.

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

The issue as far as Gitolite is concerned is that specifically the hooks/ folder doesn't exist. I can't figure out why this is, though.

Is there a way for me to diagnose what folders are created when git init --bare is run? I get the feeling that I can figure the rest out if I can figure out what's actually being executed when the command is run.

like image 298
Makoto Avatar asked Mar 06 '17 20:03

Makoto


1 Answers

It is as if, on your server, the template used for creating a new repo has an incomplete content (ie one without hooks)

That template folder would be in <git>/share/git-core/templates, with <git> being the installation folder (on Windows ./mingw64/share/git-core/templates, on Linux, /usr/share/git-core/templates)

The lack of hooks can be intentional on a server which does not want any hook executed on it for security reason. (For instance, you cannot add hooks to a GitHub bare repo)

like image 146
VonC Avatar answered Sep 21 '22 20:09

VonC