summaryrefslogtreecommitdiffhomepage
path: root/git
diff options
context:
space:
mode:
authorHsieh Chin Fan <typebrook@gmail.com>2022-02-02 13:34:47 +0800
committerHsieh Chin Fan <pham@topo.tw>2024-11-30 21:09:29 +0800
commit9934dd538b0ce116e3b1600272cb46369b082246 (patch)
tree2f28c6c362201151eaf8218e566479ed7eb72070 /git
init commit
Diffstat (limited to 'git')
-rw-r--r--git/README.md9
-rwxr-xr-xgit/create.sh53
-rwxr-xr-xgit/daemon.sh7
-rw-r--r--git/git-daemon.service21
4 files changed, 90 insertions, 0 deletions
diff --git a/git/README.md b/git/README.md
new file mode 100644
index 0000000..5637f06
--- /dev/null
+++ b/git/README.md
@@ -0,0 +1,9 @@
1## For Git Daemon
2
3read https://git-scm.com/book/be/v2/Git-on-the-Server-Git-Daemon
4
5## For Http Files for Git
6
7refs:
8- https://mtkn.jp/computer/git_server.html
9- https://codemadness.org/stagit.html
diff --git a/git/create.sh b/git/create.sh
new file mode 100755
index 0000000..f2f4227
--- /dev/null
+++ b/git/create.sh
@@ -0,0 +1,53 @@
1#!/bin/bash
2# - Makes index for repositories in a single directory.
3# - Makes static pages for each repository directory.
4#
5# NOTE, things to do manually (once) before running this script:
6# - copy style.css, logo.png and favicon.png manually, a style.css example
7# is included.
8#
9# - write clone URL, for example "git://git.codemadness.org/dir" to the "url"
10# file for each repo.
11# - write owner of repo to the "owner" file.
12# - write description in "description" file.
13#
14# Usage:
15# - mkdir -p htmldir && cd htmldir
16# - sh example_create.sh
17
18ORIG_DIR=`pwd`
19
20# path must be absolute.
21reposdir="/srv/git"
22curdir="/srv/git/www"
23
24cd ${curdir}
25
26# make files per repo.
27for dir in "${reposdir}/"*/; do
28 # strip .git suffix.
29 r=$(basename "${dir}")
30 d=$(basename "${dir}" ".git")
31 printf "%s... " "${d}"
32
33 mkdir -p "${curdir}/${d}"
34 cd "${curdir}/${d}" || continue
35
36 test -f ${dir}/owner || echo `whoami` >${dir}/owner
37 test -f ${dir}/url || echo git://git.topo.tw/${d} >${dir}/url
38
39 stagit -c ".cache" -u "https://git.codemadness.nl/$d/" "${reposdir}/${r}"
40
41 # symlinks
42 ln -sf log.html index.html
43 ln -sf ../style.css style.css
44 ln -sf ../logo.png logo.png
45 ln -sf ../favicon.png favicon.png
46
47 echo "done"
48done
49
50# make index.
51stagit-index "${reposdir}/"*/ > "${curdir}/index.html"
52
53cd ${ORIG_DIR}
diff --git a/git/daemon.sh b/git/daemon.sh
new file mode 100755
index 0000000..3cfac1b
--- /dev/null
+++ b/git/daemon.sh
@@ -0,0 +1,7 @@
1#! /bin/bash
2
3git daemon \
4 --export-all \
5 --enable=upload-archive \
6 --verbose --base-path=`pwd` \
7 -- `pwd`/*
diff --git a/git/git-daemon.service b/git/git-daemon.service
new file mode 100644
index 0000000..4641aea
--- /dev/null
+++ b/git/git-daemon.service
@@ -0,0 +1,21 @@
1[Unit]
2Description=Start Git Daemon
3Requires=network-online.target
4After=network-online.target
5
6[Service]
7ExecStart=/home/pham/git/vps/git/daemon.sh
8WorkingDirectory=/srv/git
9
10Restart=always
11RestartSec=500ms
12
13StandardOutput=syslog
14StandardError=syslog
15SyslogIdentifier=git-daemon
16
17User=pham
18Group=pham
19
20[Install]
21WantedBy=multi-user.target