commit 97d844ffbe0e4417a71395882c7eb9608530342c
parent d30575ab3ce074c8c38ab5649725423c70f4b315
Author: Julian Piribauer <julian.piribauer@gmail.com>
Date: Wed, 18 Feb 2026 22:04:55 +0100
Adding bash style
Diffstat:
| M | stagit.md | | | 32 | +++++++++++++++++++++----------- |
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/stagit.md b/stagit.md
@@ -11,9 +11,9 @@ First, we create a helper script that scans the repos/folders inside /srv/git/re
and generates a website IF A FILE git-daemon-export-ok EXISTS.
Finally, all these public repos are listed in /var/www/git/index.html.
- /usr/local/bin/update-stagit.sh:
-
- #!/bin/sh
+Create /usr/local/bin/update-stagit.sh with
+ ```bash
+ #!/bin/bash
set -eu
@@ -56,18 +56,21 @@ Finally, all these public repos are listed in /var/www/git/index.html.
rm -f "$INDEX_LIST"
echo "done"
+ ```
and make it executable:
-chmod +x /usr/local/bin/update-git.sh
+ ```bash
+ chmod +x /usr/local/bin/update-git.sh
+ ```
## Post-receive hook
We now set up a post-receive hook that creates the folder structure for new repos.
- /srv/git/template/hooks/post-receive:
+Inside /srv/git/template/hooks/post-receive:
- ```sh
- #!/bin/sh
+ ```bash
+ #!/bin/bash
/usr/local/bin/update-stagit.sh
```
@@ -76,17 +79,24 @@ Make it executable as well with chmod +.
## Set in default template
Instruct git to use it as a template:
-git config --system init.templateDir /srv/git/template
+
+ ```bash
+ git config --system init.templateDir /srv/git/template
+ ```
Finally, we give all users reading rights to all subfolders of the repo folders:
-chmod -R a+rX /srv/git/repos
-chmod -R a+rX /var/www/git
+ ```bash
+ chmod -R a+rX /srv/git/repos
+ chmod -R a+rX /var/www/git
+ ```
## Usage
New repos can now be initiated on the server with
-git init --bare my_repo.git
+ ```bash
+ git init --bare my_repo.git
+ ```
The website and the repo endpoint will be updated upon the first push (and future ones).
Make sure to create a git-daemon-export-ok file to make the repo public.