#!/bin/bash # This script creates a bare Git repository under /home/git/ # Usage: ./create-git-repo.sh set -e if [ -z "$1" ]; then echo "Error: Project name is required." echo "Usage: $0 " exit 1 fi PROJECT_NAME=$1 REPO_PATH="/home/git/${PROJECT_NAME}.git" # Create the directory mkdir -p "$REPO_PATH" # Initialize as bare repository git init --bare "$REPO_PATH" # Set ownership to user 'git' chown -R git:git "$REPO_PATH" echo "=== Repository created successfully ===" echo "Path: $REPO_PATH" echo "To clone: git clone git@your-server:${PROJECT_NAME}.git"