This statement:
And
/gits/cleu.git/hooks/post-receive
got as content:
Appears the indicate that cleu.git
is a "bare" repository. (There's a bit of info in man git-init
, but not much, really.) Typically, a git repo looks like this:
.../some-parent-dir
.git/
config
description
HEAD
hooks
... and so on ...
< your files >
A bare repository looks like this:
.../some-parent-dir.git
config
description
HEAD
hooks
... and so on ...
A bare repo is just a repo without a working directory. It's useful for storing the repository and it's history, but doesn't really lend itself well to working with it. You often see it on remotes where there's no point to having a working directory, because nobody ever works there.
Some hints that it's a bare repo, and not a normal one:
- There's no
.git
directory. - Everything that would be in the
.git
directory is instead in the main folder.
Also, the path ends in .git
, e.g., cleu.git
as opposed to just cleu
. This is just a common naming convention, however, so don't depend on it, but it is common to see bare repos named like that.
But where's the data?
The history is in objects
. It's stored in a complicated manner; don't try to get it directly¹. Instead, just try cloning the repo:
git clone ssh://user@vpsipadress/gits/cleu.git
cd cleu
# Now take a look around.
¹Unless you'd like to learn a lot about how git
works internally. It's really cool, but kinda complex. Git Internals should offer a starting place.
And about that script…
The hook script post-receive
is just an executable, here, just a shell script:
#!/bin/sh
git --work-tree=/sites/node/cleu --git-dir=/gits/cleu.git
checkout -f
Note, however, that shell scripts needs commands to be on one line, like:
#!/bin/sh
git --work-tree=/sites/node/cleu --git-dir=/gits/cleu.git checkout -f
(becuase git checkout
is the command here) or, alternatively, you can break this up with line continuations:
#!/bin/sh
git --work-tree=/sites/node/cleu --git-dir=/gits/cleu.git \
checkout -f
I've indented it to more clearly denote the continuation; this is stylistic, and not strictly required, but I find it more readable. You could even:
#!/bin/sh
git \
--work-tree=/sites/node/cleu \
--git-dir=/gits/cleu.git \
checkout -f