-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathserve-git.sh
More file actions
28 lines (26 loc) · 815 Bytes
/
serve-git.sh
File metadata and controls
28 lines (26 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
# file: serve-git.sh
# vim:fileencoding=utf-8:ft=sh
# Starts the git daemon for all git repositories under the current working
# directory.
#
# Copyright © 2015,2016,2019 R.F. Smith <rsmith@xs4all.nl>.
# SPDX-License-Identifier: MIT
# Created: 2016-03-19T10:35:02+0100
# Last modified: 2021-11-30T23:19:48+0100
# Check for special programs that are used in this script.
PROGS="git"
for P in $PROGS; do
which $P >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "$(basename $0): The program \"$P\" cannot be found."
exit 1
fi
done
set -eu
WD=$(pwd)
GITDIRS=$(find "$WD" -type d -name '.git'|sort)
echo "Starting git-daemon for the following directories:"
echo $GITDIRS|fmt
echo "Press CTRL-C to quit."
git daemon --reuseaddr --verbose --export-all --base-path=/home/rsmith $GITDIRS