From a1585e0c26fe78d675c9ef2cace389fd4aeca9cc Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Fri, 5 Dec 2025 22:40:48 -0800 Subject: Fix description flags --- Dockerfile | 3 +++ init-repo | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index ecb4743..6a79434 100644 --- a/Dockerfile +++ b/Dockerfile @@ -53,6 +53,9 @@ RUN mkdir -p /var/lib/git/repositories RUN useradd -m -d /var/lib/git/repositories -s /usr/bin/git-shell code +# Set default branch to main for the code user +RUN git config --system init.defaultBranch main + # Store git-shell-commands in a persistent location (will be copied to home on startup) RUN mkdir -p /usr/local/share/git-shell-commands COPY init-repo /usr/local/share/git-shell-commands/init-repo diff --git a/init-repo b/init-repo index 5749866..209d742 100644 --- a/init-repo +++ b/init-repo @@ -2,7 +2,7 @@ # Helper script for git-shell to initialize bare repositories # Usage: ssh code@host init-repo [description] -if [ $# -lt 1 ] || [ $# -gt 2 ]; then +if [ $# -lt 1 ]; then echo "Usage: init-repo [description]" echo "Example: init-repo myproject.git" echo "Example: init-repo myproject.git 'A repo with foo'" @@ -10,7 +10,8 @@ if [ $# -lt 1 ] || [ $# -gt 2 ]; then fi REPO_NAME="$1" -DESCRIPTION="$2" +shift +DESCRIPTION="$*" # Ensure it ends with .git case "$REPO_NAME" in @@ -26,7 +27,7 @@ if [ -e "$REPO_DIR" ]; then fi echo "Initializing bare repository: $REPO_NAME" -git init --bare "$REPO_DIR" +git init --bare --initial-branch=main "$REPO_DIR" # Add description if provided if [ -n "$DESCRIPTION" ]; then -- cgit v1.2.3-70-g09d2