--- /dev/null
+.PHONY: install uninstall
+install:
+ mkdir -p /usr/share/sockgit/templates && cp -r templates/*
+ cp sockgit-listen* /etc/systemd/system/
+ ln -s $(shell pwd)/sockgit.sh /usr/bin/sockgit
+
+uninstall:
+ rm -f /etc/systemd/system/sockgit-listen*
+ rm -rf /usr/share/sockgit
+ rm -f /usr/bin/sockgit
--- /dev/null
+# Sockgit
+
+A simple service that allows creation of a new git repository without all of the trouble of having to actually ssh in and remember what to do as your stripped down `git` user.
+
+## Requirements
+
+- `netcat`
--- /dev/null
+[Unit]
+Description=Sockgit Listening Socket
+PartOf=sockgit-listen@.service
+
+[Socket]
+ListenStream=9119
+Accept=yes
+
+[Install]
+WantedBy=sockets.target
--- /dev/null
+[Unit]
+Description=Sockgit Listen Server
+After=network.target sockgit-listen.socket
+Requires=sockgit-listen.socket
+
+[Service]
+Type=oneshot
+User=git
+Group=git
+WorkingDirectory=/srv/git
+ExecStart=/bin/bash -c 'while read REPO; do /usr/bin/git init --bare --shared $REPO.git && cd $REPO.git && /usr/bin/git remote add public $USER@$PUBLIC:$PATH/$REPO.git; done;'
+StandardInput=socket
+StandardOutput=syslog
+StandardError=syslog
+Environment="USER=git"
+Environment="PUBLIC=add your url"
+Environment="PATH=/srv/git"
+Environment="GIT_TEMPLATE_DIR=/usr/share/sockgit/templates"
+
+[Install]
+WantedBy=multi-user.target
--- /dev/null
+#!/bin/bash
+if [ $# -lt 2 ]
+then
+ echo $#
+ echo "Usage: sockgit <host> <repo-name>"
+ exit 1
+fi
+if [ -z $PORT ]
+then
+ PORT=9119
+fi
+echo $2 | timeout 1 netcat $1 $PORT
--- /dev/null
+Unnamed repository; edit this file 'description' to name the repository.
--- /dev/null
+Unnamed repository; edit this file 'description' to name the repository.
--- /dev/null
+# git ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~