From 8667f8615da479a8e9c4e8d5bb5987632d75bfaf Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Fri, 5 Dec 2025 21:43:18 -0800 Subject: Add ssh server --- delete-repo | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 delete-repo (limited to 'delete-repo') diff --git a/delete-repo b/delete-repo new file mode 100644 index 0000000..0eecf4c --- /dev/null +++ b/delete-repo @@ -0,0 +1,47 @@ +#!/bin/sh +# Helper script for git-shell to delete bare repositories +# Usage: ssh code@host delete-repo + +if [ $# -ne 1 ]; then + echo "Usage: delete-repo " + echo "Example: delete-repo myproject.git" + exit 1 +fi + +REPO_NAME="$1" + +# Ensure it ends with .git +case "$REPO_NAME" in + *.git) ;; + *) REPO_NAME="${REPO_NAME}.git" ;; +esac + +REPO_DIR="$HOME/$REPO_NAME" + +if [ ! -e "$REPO_DIR" ]; then + echo "Error: Repository '$REPO_NAME' does not exist" + exit 1 +fi + +if [ ! -d "$REPO_DIR" ]; then + echo "Error: '$REPO_NAME' is not a directory" + exit 1 +fi + +# Safety check - make sure it looks like a git repository +if [ ! -f "$REPO_DIR/config" ] || [ ! -d "$REPO_DIR/objects" ]; then + echo "Error: '$REPO_NAME' does not appear to be a git repository" + exit 1 +fi + +echo "WARNING: This will permanently delete the repository '$REPO_NAME'" +echo "Type 'yes' to confirm deletion:" +read -r confirmation + +if [ "$confirmation" = "yes" ]; then + rm -rf "$REPO_DIR" + echo "Repository '$REPO_NAME' has been deleted" +else + echo "Deletion cancelled" + exit 1 +fi -- cgit v1.2.3-70-g09d2