mirror of
https://github.com/terraphim/gitea-infrastructure.git
synced 2026-07-16 00:00:32 +02:00
Automated fix from pre-commit hooks (trailing-whitespace, end-of-file-fixer). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5.2 KiB
5.2 KiB
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:
- Go to https://git.terraphim.cloud
- Click "+" → "New Repository"
- Owner:
terraphim - Repository Name:
gitea-infrastructure - Description:
Gitea deployment configuration - Visibility: ☑️ Private
- ☐ Uncheck "Initialize Repository"
- Click "Create Repository"
Result: Empty repository created
Step 2: Push to Gitea
cd /home/alex/infrastructure/gitea-config
# Push to Gitea
git push origin main
Step 3: Configure GitHub Actions Secrets
On GitHub:
- Go to: https://github.com/terraphim/gitea-infrastructure/settings/secrets/actions
- Click "New repository secret"
- Add:
- Name:
GITEA_TOKEN - Secret: Your Gitea API token
- Name:
To create Gitea API token:
- Go to https://git.terraphim.cloud/user/settings/applications
- Click "Generate New Token"
- Token Name:
GitHub Actions Sync - Select scopes:
repo,write:repo - Click "Generate Token"
- Copy the token
Step 4: Test Mirroring
Push to GitHub:
# 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
# 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:
- Developer pushes to GitHub
- GitHub Actions automatically pushes to Gitea
- Gitea stays in sync as mirror
Commands:
# 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:
# 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:
- Go to repository Settings → Repository
- Scroll to Mirror Settings
- Check "Push Mirror"
- Git Remote URL:
https://github.com/terraphim/gitea-infrastructure.git - Authentication:
- Username: Your GitHub username
- Password: GitHub Personal Access Token
- Interval:
1h(or your preference) - Click "Add Push Mirror"
To create GitHub token:
- Go to https://github.com/settings/tokens
- Click "Generate new token (classic)"
- Select scope:
repo - 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:
# 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
- ✅ Create Gitea repository
- ✅ Add GitHub Actions secret (GITEA_TOKEN)
- ✅ Push to Gitea
- ✅ Test mirroring with a commit
- 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
reposcope - 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! 🎉