Added rgit script
authorCian Bagshaw <cian@cianb.xyz>
Sun, 15 Jan 2023 16:44:11 +0000 (16:44 +0000)
committerCian Bagshaw <cian@cianb.xyz>
Sun, 15 Jan 2023 16:44:11 +0000 (16:44 +0000)
Script for automatically creating and adding remote git repos

.local/bin/rgit [new file with mode: 0755]

diff --git a/.local/bin/rgit b/.local/bin/rgit
new file mode 100755 (executable)
index 0000000..5aa4b6a
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# login
+USER=root
+HOST=cianb.xyz
+
+# git dir
+DIR=/var/www/git.cianb.xyz
+
+# init script
+SCRIPT="cd $DIR; sudo -u git mkdir $1; sudo -u git git init $1 --bare"
+
+# login and run
+ssh $USER@$HOST $SCRIPT
+
+# add remote
+git remote add origin git@$HOST:$DIR/$1