scripting setup /srv/git/ repos on helio-web
authorShane <chown_tee@proton.me>
Sun, 11 Jan 2026 02:40:15 +0000 (02:40 +0000)
committerShane <chown_tee@proton.me>
Sun, 11 Jan 2026 02:40:23 +0000 (02:40 +0000)
.env
.envrc [new file with mode: 0644]
Makefile

diff --git a/.env b/.env
index cc0a371de2b778e5d97b254dcdf07846ba610dc3..22eca3cd6ea6283583d310c1af8f39cfcc883181 100644 (file)
--- a/.env
+++ b/.env
@@ -1,4 +1,4 @@
 VPS_HOST=dev.nutra.tk
 VPS_USER=gg
 export SUDO_USER=gg
-
+export OWNER="Shane J"
diff --git a/.envrc b/.envrc
new file mode 100644 (file)
index 0000000..7a54737
--- /dev/null
+++ b/.envrc
@@ -0,0 +1,2 @@
+source .env
+
index 4b15fcdb706fcbf6f36171dcb53ef9d225242d33..496d8e727f385fd295474ef29d7ace6d9bc02b02 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -144,3 +144,22 @@ ifdef SUDO_USER
 else
        python3 scripts/update_repo_metadata.py $(or $(CSV),scripts/repo_metadata.csv)
 endif
+
+.PHONY: git/init-remote
+git/init-remote: ##H @Remote Initialize a new bare repository on VPS (usage: make git/init-remote REPO=projects/new-repo.git)
+ifndef REPO,OWNER,DESC
+       $(error REPO/OWNER/DESC are undefined: '$(REPO)/$$OWNER/$(DESC)'). Usage: make git/init-remote REPO=projects/new-repo.git OWNER="Shane" DESC="New repository")
+endif
+       @echo "Initializing bare repository $(REPO) on $(VPS_HOST)..."
+       ssh $(VPS) "mkdir -p /srv/git/$(REPO) && cd /srv/git/$(REPO) && git init --bare && touch git-daemon-export-ok"
+ifdef OWNER
+       @echo "Setting owner to $(OWNER)..."
+       ssh $(VPS) "git config --file /srv/git/$(REPO)/config gitweb.owner '$(OWNER)'"
+endif
+ifdef DESC
+       @echo "Setting description to $(DESC)..."
+       ssh $(VPS) "echo '$(DESC)' > /srv/git/$(REPO)/description"
+endif
+       @echo "Repository created. You can now push to it:"
+       @echo "  git remote add origin $(VPS_USER)@$(VPS_HOST):/srv/git/$(REPO)"
+       @echo "  git push -u origin main"