From 6637bb49e7d8edeaac9ffae12118f5b968da52c4 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 23 Nov 2025 22:10:12 +0000 Subject: [PATCH] Update: init-project to use SSH remotes for VPS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Changed remote format: HTTP → SSH (git@host:org/repo.git) - Better for VPS deployments (key-based auth) - Check for SSH key and warn if missing - Provide setup instructions in init output - Agents still copied to .claude/agents/ --- scripts/init-project.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/init-project.sh b/scripts/init-project.sh index 555b6aa..27ad59c 100755 --- a/scripts/init-project.sh +++ b/scripts/init-project.sh @@ -7,7 +7,7 @@ # This script: # - Creates a new project directory # - Initializes git repository -# - Configures Gitea remote automatically +# - Configures Gitea SSH remote automatically # - Copies agents to .claude/agents/ for Claude Code # - Sets up git user info @@ -22,9 +22,9 @@ if [[ ! "$PROJECT_NAME" =~ ^[a-zA-Z0-9._-]+$ ]]; then exit 1 fi -GITEA_URL="http://100.120.125.113:3000" +GITEA_HOST="100.120.125.113" GITEA_ORG="pdm" -REPO_URL="$GITEA_URL/$GITEA_ORG/$PROJECT_NAME.git" +REPO_URL="git@$GITEA_HOST:$GITEA_ORG/$PROJECT_NAME.git" AGENTS_SOURCE="$HOME/.homelab-agents/agents" # Check if directory already exists @@ -33,6 +33,15 @@ if [[ -d "$PROJECT_NAME" ]]; then exit 1 fi +# Check for SSH key (needed for git push to work) +if [[ ! -f "$HOME/.ssh/id_ed25519" ]] && [[ ! -f "$HOME/.ssh/id_rsa" ]]; then + echo "⚠️ Warning: No SSH key found" + echo " For git push to work, you need to:" + echo " 1. Generate SSH key: ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519" + echo " 2. Add to Gitea: http://100.120.125.113:3000 → Settings → SSH Keys" + echo "" +fi + echo "📁 Creating project directory: $PROJECT_NAME" mkdir -p "$PROJECT_NAME" cd "$PROJECT_NAME" @@ -43,7 +52,7 @@ git config user.name "Homelab Automation" git config user.email "automation@homelab" git branch -M main -echo "🔗 Configuring Gitea remote..." +echo "🔗 Configuring Gitea SSH remote..." git remote add origin "$REPO_URL" echo "📚 Setting up Claude Code agents..." @@ -75,4 +84,4 @@ echo "🚀 Next steps:" echo " 1. Start working in this directory" echo " 2. Create files and make changes" echo " 3. When done, use the summary agent: .claude/agents/sysadmin-session-closer.md" -echo " 4. Agent will automatically commit and push to Gitea" \ No newline at end of file +echo " 4. Agent will automatically commit and push to Gitea (via SSH)" \ No newline at end of file