# Quick Setup: Repository Mirroring Your repository is now on **GitHub** and ready for mirroring! ## Current Status ✅ **GitHub Repository:** https://github.com/terraphim/gitea-infrastructure ❌ **Gitea Repository:** Not created yet ## Setup Steps ### Step 1: Create Repository on Gitea **Via Web Interface:** 1. Go to https://git.terraphim.cloud 2. Click **"+"** → **"New Repository"** 3. **Owner:** `terraphim` 4. **Repository Name:** `gitea-infrastructure` 5. **Description:** `Gitea deployment configuration` 6. **Visibility:** ☑️ Private 7. ☐ **Uncheck** "Initialize Repository" 8. Click **"Create Repository"** **Result:** Empty repository created ### Step 2: Push to Gitea ```bash cd /home/alex/infrastructure/gitea-config # Push to Gitea git push origin main ``` ### Step 3: Configure GitHub Actions Secrets **On GitHub:** 1. Go to: https://github.com/terraphim/gitea-infrastructure/settings/secrets/actions 2. Click **"New repository secret"** 3. Add: - **Name:** `GITEA_TOKEN` - **Secret:** Your Gitea API token **To create Gitea API token:** 1. Go to https://git.terraphim.cloud/user/settings/applications 2. Click **"Generate New Token"** 3. **Token Name:** `GitHub Actions Sync` 4. Select scopes: `repo`, `write:repo` 5. Click **"Generate Token"** 6. Copy the token ### Step 4: Test Mirroring **Push to GitHub:** ```bash # Make a change echo "# Mirroring test" >> README.md git add README.md git commit -m "test: Mirroring to Gitea" # Push to GitHub (triggers Actions) git push github main ``` **Check Gitea:** - Go to https://git.terraphim.cloud/terraphim/gitea-infrastructure - Verify the commit appears ## Current Remote Configuration ```bash # Check remotes git remote -v # Should show: # origin https://git.terraphim.cloud/terraphim/gitea-infrastructure.git (fetch) # origin https://git.terraphim.cloud/terraphim/gitea-infrastructure.git (push) # github https://github.com/terraphim/gitea-infrastructure.git (fetch) # github https://github.com/terraphim/gitea-infrastructure.git (push) ``` ## Two-Way Sync Workflow ### Option A: GitHub as Primary (Recommended) **How it works:** 1. Developer pushes to GitHub 2. GitHub Actions automatically pushes to Gitea 3. Gitea stays in sync as mirror **Commands:** ```bash # Work locally git push github main # Primary push (triggers Actions) # Or push to both manually git push github main && git push origin main ``` ### Option B: Push to Both **Set up alias:** ```bash # Add to ~/.gitconfig git config --global alias.pushall '!git push github $(git branch --show-current) && git push origin $(git branch --show-current)' # Usage git pushall # Pushes to both ``` ### Option C: Gitea as Primary **Configure in Gitea:** 1. Go to repository **Settings** → **Repository** 2. Scroll to **Mirror Settings** 3. Check **"Push Mirror"** 4. **Git Remote URL:** `https://github.com/terraphim/gitea-infrastructure.git` 5. **Authentication:** - **Username:** Your GitHub username - **Password:** GitHub Personal Access Token 6. **Interval:** `1h` (or your preference) 7. Click **"Add Push Mirror"** **To create GitHub token:** 1. Go to https://github.com/settings/tokens 2. Click **"Generate new token (classic)"** 3. Select scope: `repo` 4. Generate and copy token ## Repository Structure After setup, both repositories will have: ``` gitea-infrastructure/ ├── .docs/ # Documentation │ ├── RESEARCH-gitea-bigbox-deployment.md │ ├── IMPLEMENTATION-gitea-bigbox-deployment.md │ ├── DEPLOYMENT-SUMMARY.md │ └── summary-*.md ├── .github/ │ └── workflows/ # GitHub Actions │ ├── sync-to-gitea.yml # Sync GitHub → Gitea │ └── mirror-check.yml # Check sync status ├── .gitignore # Excludes secrets ├── ARTICLE-gitea-deployment.md # Main article ├── Caddyfile # Caddy config ├── MIRRORING-GUIDE.md # This guide ├── README.md # Project overview ├── REPOSITORY-SETUP.md # Setup guide ├── deploy-to-bigbox.sh # Deployment script ├── docker-compose.yml.template # Template with op:// └── s3_config.json.template # Template with op:// ``` ## Verification **Check sync status:** ```bash # Manual check ./check-mirror.sh # GitHub Actions will run every 6 hours automatically ``` **View on GitHub:** https://github.com/terraphim/gitea-infrastructure **View on Gitea:** https://git.terraphim.cloud/terraphim/gitea-infrastructure ## Next Steps 1. ✅ Create Gitea repository 2. ✅ Add GitHub Actions secret (GITEA_TOKEN) 3. ✅ Push to Gitea 4. ✅ Test mirroring with a commit 5. Document your mirroring strategy for team members ## Troubleshooting **GitHub Actions failing?** - Check GITEA_TOKEN is set correctly - Verify Gitea repository exists - Check Actions logs for details **Gitea push mirror failing?** - Verify GitHub token has `repo` scope - Check repository URL is correct - Review Gitea logs for errors **Conflicts?** - Stop both mirrors - Resolve conflicts locally - Push to both repositories - Re-enable mirrors --- **Your repository is ready for mirroring!** 🎉