4.1 KiB
4.1 KiB
Gitea Sync Skill
Skill Name: gitea-sync
Category: quick
Load Skills: [] (standalone)
🎯 Purpose
Automatically sync repositories to Gitea (git.moreminimore.com):
- Create new repositories
- Update existing repositories
- Push code automatically
- Auto-detect new vs existing repos
🔧 Prerequisites
Gitea API Token
Get your API token from:
https://git.moreminimore.com/user/settings/applications
- Login to Gitea
- Go to Settings → Applications
- Generate new token (name it "opencode-skills")
- Copy the token
- Add to unified
.envfile
🚀 Usage
Sync New Repository
python3 scripts/sync.py \
--repo my-website \
--path ./my-website \
--description "My PDPA-compliant website"
Sync Without Pushing
python3 scripts/sync.py \
--repo my-website \
--path ./my-website \
--no-push
Parameters
| Parameter | Required | Default | Description |
|---|---|---|---|
--repo |
✅ | - | Repository name |
--path |
✅ | - | Path to code directory |
--description |
❌ | "" | Repository description |
--no-push |
❌ | false | Don't push code |
--private |
❌ | false | Make private (not implemented) |
🔄 Workflow
Auto-Detection
The script automatically detects:
- New repository → Creates with
auto_init - Existing repository → Updates metadata
Push Process
- Initialize git (if not already)
- Add
.gitignore(if not exists) - Configure authentication (uses API token)
- Add all files
- Commit with message "Auto-sync from website-creator"
- Push to Gitea (force push for initial push)
📁 Files
gitea-sync/
├── SKILL.md
└── scripts/
├── sync.py # Main script
├── .env.example # Configuration template
└── requirements.txt
🔐 Authentication
Uses Gitea API token for authentication:
- Stored in unified
.envfile - Format:
Authorization: token <API_TOKEN> - Token embedded in git URL for push operations
✅ Success Criteria
After sync:
- ✅ Repository created/updated on Gitea
- ✅ Code pushed to
mainbranch - ✅
.gitignorecreated - ✅ Git remote configured
- ✅ Repository URL returned
🌐 Repository URL
Format:
https://git.moreminimore.com/<username>/<repo-name>
⚠️ Troubleshooting
| Issue | Solution |
|---|---|
| 401 Unauthorized | Check API token in .env |
| 409 Conflict | Repository already exists (normal) |
| Push failed | Check git credentials, verify token |
| Not a git repo | Script auto-initializes (shouldn't fail) |
🔄 Integration
Used by:
website-creatorskill (auto-deploy workflow)- Manual sync (standalone usage)
📝 Example Output
🔄 Gitea Sync
==================================================
Repository: my-website
Path: ./my-website
Description: My PDPA-compliant website
==================================================
🔐 Authenticated as: kunthawatgreethong
📦 Creating repository: my-website
✅ Repository created: my-website
🚀 Pushing code to Gitea
→ Initializing git repository
→ Adding remote: https://git.moreminimore.com/...
→ Adding files
→ Committing changes
→ Pushing to Gitea
✅ Code pushed successfully
🌐 Repository URL: https://git.moreminimore.com/kunthawatgreethong/my-website
==================================================
✅ Sync complete!
Repository: my-website
URL: https://git.moreminimore.com/kunthawatgreethong/my-website
Status: Created new repository
==================================================
🎯 API Endpoints Used
| Endpoint | Method | Purpose |
|---|---|---|
/api/v1/user |
GET | Verify authentication |
/api/v1/repos/{user}/{repo} |
GET | Check if repo exists |
/api/v1/user/repos |
POST | Create repository |
/api/v1/repos/{user}/{repo} |
PATCH | Update repository |
| Git push | POST | Push code (via git protocol) |
📞 Support
For issues with Gitea:
- Check API token validity
- Verify repository permissions
- Review Gitea logs at:
https://git.moreminimore.com/explore