Initial commit: Homelab infrastructure repository with automated collection system
- Added Proxmox VE configuration collection scripts - Included documentation and quick-start guides - First infrastructure snapshot from serviceslab (2025-11-29) - All VM configs (10 VMs) and LXC configs (3 containers) - Git setup complete with .gitignore protecting sensitive data
This commit is contained in:
139
git-first-commit.sh
Normal file
139
git-first-commit.sh
Normal file
@@ -0,0 +1,139 @@
|
||||
#!/bin/bash
|
||||
# First-time Git Setup and Initial Commit Helper
|
||||
# This script helps you make your first commit to the homelab repository
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for pretty output
|
||||
GREEN='\033[0;32m'
|
||||
BLUE='\033[0;34m'
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo -e "${BLUE}================================================${NC}"
|
||||
echo -e "${BLUE} Homelab Git - Initial Commit Setup${NC}"
|
||||
echo -e "${BLUE}================================================${NC}"
|
||||
echo
|
||||
|
||||
# Check if we're in the right directory
|
||||
if [ ! -d ".git" ]; then
|
||||
echo -e "${RED}Error: Not in a git repository!${NC}"
|
||||
echo "Please run this script from /home/jramos/homelab"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if git user is configured
|
||||
USER_NAME=$(git config --global user.name 2>/dev/null || echo "")
|
||||
USER_EMAIL=$(git config --global user.email 2>/dev/null || echo "")
|
||||
|
||||
if [ -z "$USER_NAME" ] || [ -z "$USER_EMAIL" ]; then
|
||||
echo -e "${YELLOW}Git user not configured. Let's set that up first.${NC}"
|
||||
echo
|
||||
|
||||
# Get user name
|
||||
if [ -z "$USER_NAME" ]; then
|
||||
echo -e "${BLUE}Enter your name (e.g., 'John Smith'):${NC}"
|
||||
read -p "> " USER_NAME
|
||||
git config --global user.name "$USER_NAME"
|
||||
echo -e "${GREEN}Name set to: $USER_NAME${NC}"
|
||||
fi
|
||||
|
||||
# Get user email
|
||||
if [ -z "$USER_EMAIL" ]; then
|
||||
echo
|
||||
echo -e "${BLUE}Enter your email (e.g., 'john@example.com'):${NC}"
|
||||
read -p "> " USER_EMAIL
|
||||
git config --global user.email "$USER_EMAIL"
|
||||
echo -e "${GREEN}Email set to: $USER_EMAIL${NC}"
|
||||
fi
|
||||
|
||||
echo
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}Git user configured:${NC}"
|
||||
echo " Name: $(git config --global user.name)"
|
||||
echo " Email: $(git config --global user.email)"
|
||||
echo
|
||||
|
||||
# Show current status
|
||||
echo -e "${YELLOW}Current repository status:${NC}"
|
||||
git status
|
||||
echo
|
||||
|
||||
# Ask about .env file
|
||||
echo -e "${YELLOW}About the .env file:${NC}"
|
||||
echo "The .gitignore file is configured to IGNORE your .env file"
|
||||
echo "(it contains sensitive information and should not be committed)"
|
||||
echo
|
||||
echo "Only .env.example will be tracked in git."
|
||||
echo
|
||||
|
||||
# Ask if ready to commit
|
||||
echo -e "${BLUE}Ready to create your first commit?${NC}"
|
||||
echo "This will add all files (except those in .gitignore) to version control."
|
||||
echo
|
||||
read -p "Continue? (y/n): " -n 1 -r
|
||||
echo
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||
echo -e "${YELLOW}Commit cancelled. No changes made.${NC}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Add all files
|
||||
echo
|
||||
echo -e "${YELLOW}Step 1: Adding files to staging area...${NC}"
|
||||
git add .
|
||||
|
||||
# Show what will be committed
|
||||
echo
|
||||
echo -e "${YELLOW}Step 2: Files to be committed:${NC}"
|
||||
git status
|
||||
|
||||
# Create the commit
|
||||
echo
|
||||
echo -e "${YELLOW}Step 3: Creating initial commit...${NC}"
|
||||
git commit -m "Initial commit: Homelab infrastructure repository
|
||||
|
||||
This commit includes:
|
||||
- Proxmox configuration collection scripts
|
||||
- Environment configuration templates
|
||||
- Comprehensive documentation
|
||||
- Git ignore patterns for sensitive data
|
||||
|
||||
Infrastructure: Proxmox VE 8.3.3
|
||||
Node: serviceslab
|
||||
VMs: 11 virtual machines (docker-hub, gitlab, dev, ansible, CML, web servers, db)
|
||||
Containers: 3 LXC containers (nginx, netbox, anytype)
|
||||
"
|
||||
|
||||
echo
|
||||
echo -e "${GREEN}================================================${NC}"
|
||||
echo -e "${GREEN} Success! Your homelab is now under version control${NC}"
|
||||
echo -e "${GREEN}================================================${NC}"
|
||||
echo
|
||||
echo "What you can do now:"
|
||||
echo
|
||||
echo -e "${BLUE}View commit history:${NC}"
|
||||
echo " git log"
|
||||
echo
|
||||
echo -e "${BLUE}View changes since last commit:${NC}"
|
||||
echo " git status"
|
||||
echo " git diff"
|
||||
echo
|
||||
echo -e "${BLUE}Make changes and commit them:${NC}"
|
||||
echo " # Make your changes to files"
|
||||
echo " git add <file> # Stage specific file"
|
||||
echo " git add . # Stage all changes"
|
||||
echo " git commit -m \"Description\" # Commit with message"
|
||||
echo
|
||||
echo -e "${BLUE}View file history:${NC}"
|
||||
echo " git log --oneline"
|
||||
echo " git log --graph --oneline --all"
|
||||
echo
|
||||
echo -e "${YELLOW}Repository location:${NC}"
|
||||
echo " Linux: /home/jramos/homelab"
|
||||
echo " Windows: \\\\wsl\$\\Ubuntu\\home\\jramos\\homelab"
|
||||
echo
|
||||
echo -e "${GREEN}Happy homelabbing!${NC}"
|
||||
echo
|
||||
Reference in New Issue
Block a user