- Copy actual .gitconfig instead of placeholder - Create encrypted SSH key backup script with GPG - Add SSH-based remote setup script - Include restore instructions and security notes 🤖 Generated with Claude Code (https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
92 lines
2.6 KiB
Bash
Executable File
92 lines
2.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Setup GitHub and Gitea remotes using SSH
|
|
|
|
set -euo pipefail
|
|
|
|
# Colors
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
RED='\033[0;31m'
|
|
NC='\033[0m'
|
|
|
|
echo -e "${BLUE}Setting up Git remotes with SSH${NC}"
|
|
echo "=================================="
|
|
|
|
cd ~/dotfiles
|
|
|
|
# Get GitHub username
|
|
echo -e "${YELLOW}What's your GitHub username?${NC}"
|
|
read -p "GitHub username: " GITHUB_USER
|
|
|
|
# Get Gitea details (optional)
|
|
echo ""
|
|
echo -e "${YELLOW}Gitea setup (optional - press Enter to skip):${NC}"
|
|
read -p "Gitea server URL (e.g., git.yourdomain.com): " GITEA_SERVER
|
|
if [ -n "$GITEA_SERVER" ]; then
|
|
read -p "Gitea username: " GITEA_USER
|
|
fi
|
|
|
|
echo ""
|
|
echo -e "${BLUE}Setting up remotes...${NC}"
|
|
|
|
# Add GitHub remote
|
|
if ! git remote get-url github >/dev/null 2>&1; then
|
|
git remote add github git@github.com:${GITHUB_USER}/dotfiles.git
|
|
echo -e "${GREEN}✓ Added GitHub remote${NC}"
|
|
else
|
|
echo -e "${YELLOW}GitHub remote already exists${NC}"
|
|
fi
|
|
|
|
# Add Gitea remote if provided
|
|
if [ -n "$GITEA_SERVER" ] && [ -n "$GITEA_USER" ]; then
|
|
if ! git remote get-url gitea >/dev/null 2>&1; then
|
|
git remote add gitea git@${GITEA_SERVER}:${GITEA_USER}/dotfiles.git
|
|
echo -e "${GREEN}✓ Added Gitea remote${NC}"
|
|
else
|
|
echo -e "${YELLOW}Gitea remote already exists${NC}"
|
|
fi
|
|
fi
|
|
|
|
echo ""
|
|
echo -e "${BLUE}Manual steps required:${NC}"
|
|
echo ""
|
|
echo "1. 📋 Create repositories manually:"
|
|
echo " • GitHub: https://github.com/new"
|
|
echo " - Repository name: dotfiles"
|
|
echo " - Description: 🖖 Complete macOS dotfiles system - 'Engage!'"
|
|
echo " - Public repository"
|
|
echo " - Don't initialize with README, .gitignore, or license"
|
|
|
|
if [ -n "$GITEA_SERVER" ]; then
|
|
echo " • Gitea: https://${GITEA_SERVER}/repo/create"
|
|
echo " - Repository name: dotfiles"
|
|
echo " - Description: 🖖 Complete macOS dotfiles system - 'Engage!'"
|
|
echo " - Public repository"
|
|
fi
|
|
|
|
echo ""
|
|
echo "2. 🔑 Test SSH access:"
|
|
echo " ssh -T git@github.com"
|
|
if [ -n "$GITEA_SERVER" ]; then
|
|
echo " ssh -T git@${GITEA_SERVER}"
|
|
fi
|
|
|
|
echo ""
|
|
echo "3. 🚀 Push to remotes:"
|
|
echo " git push -u github master"
|
|
if [ -n "$GITEA_SERVER" ]; then
|
|
echo " git push -u gitea master"
|
|
fi
|
|
|
|
echo ""
|
|
echo -e "${GREEN}Remote setup complete!${NC}"
|
|
echo ""
|
|
echo "Your repositories will be available at:"
|
|
echo "• GitHub: https://github.com/${GITHUB_USER}/dotfiles"
|
|
if [ -n "$GITEA_SERVER" ]; then
|
|
echo "• Gitea: https://${GITEA_SERVER}/${GITEA_USER}/dotfiles"
|
|
fi
|
|
echo ""
|
|
echo -e "${BLUE}Clone command for new machines:${NC}"
|
|
echo "git clone git@github.com:${GITHUB_USER}/dotfiles.git ~/dotfiles && ~/dotfiles/engage" |