From 5d7eea3120d9fb0e1bb0fcbc195efa8862f63fb8 Mon Sep 17 00:00:00 2001 From: xiaohei Date: Mon, 9 Mar 2026 10:15:52 +0800 Subject: [PATCH] Add gitea skill for configuration and repository management --- skills/gitea/SKILL.md | 122 ++++++++++++++++++++ skills/gitea/references/gitea-config.md | 146 ++++++++++++++++++++++++ 2 files changed, 268 insertions(+) create mode 100644 skills/gitea/SKILL.md create mode 100644 skills/gitea/references/gitea-config.md diff --git a/skills/gitea/SKILL.md b/skills/gitea/SKILL.md new file mode 100644 index 0000000..2b8e96a --- /dev/null +++ b/skills/gitea/SKILL.md @@ -0,0 +1,122 @@ +--- +name: gitea +description: Gitea integration and repository management. Use when user needs to: (1) Configure Gitea connection and SSH access, (2) Create and manage Gitea repositories, (3) Set up Git global configuration, (4) Push/pull code from Gitea, (5) Add SSH keys to Gitea account. Handles SSH key generation, Gitea API operations, and Git workflow automation. +--- + +# Gitea + +## Overview + +Manage Gitea self-hosted Git service integration, including SSH key setup, repository creation, and Git configuration for seamless workflow. + +## Core Capabilities + +### 1. Initial Configuration +- Set up Git global config (user.name, user.email) +- Generate SSH key pair (ED25519 preferred) +- Configure SSH to use custom port (default: 4022) +- Add SSH public key to Gitea via API + +### 2. Repository Management +- Create new repositories via Gitea API +- Initialize local git repository +- Configure git remote (origin) +- Create initial commit with .gitignore + +### 3. SSH Connection +- Configure SSH host in ~/.ssh/config +- Add host to known_hosts +- Test SSH connection to Gitea +- Push code to remote repository + +## Configuration File + +See [references/gitea-config.md](references/gitea-config.md) for: +- Current Gitea server details +- SSH configuration +- API access information +- Git global settings + +## Workflow: Full Setup + +### Step 1: Git Global Configuration +```bash +git config --global user.name "username" +git config --global user.email "email@example.com" +``` + +### Step 2: Generate SSH Key +```bash +ssh-keygen -t ed25519 -C "email@example.com" -f ~/.ssh/id_ed25519 -N "" +``` + +### Step 3: Add SSH Key to Gitea +```bash +# Read public key +cat ~/.ssh/id_ed25519.pub + +# Add via API +curl -X POST "http://GITEA_URL/api/v1/user/keys" \ + -H "Authorization: token ACCESS_TOKEN" \ + -H "Content-Type: application/json" \ + -d '{"title":"KEY_NAME","key":"PUBLIC_KEY"}' +``` + +### Step 4: Configure SSH +Add to ~/.ssh/config: +``` +Host GITEA_IP + HostName GITEA_IP + Port SSH_PORT + User git + IdentityFile ~/.ssh/id_ed25519 +``` + +### Step 5: Create Repository +```bash +curl -X POST "http://GITEA_URL/api/v1/user/repos" \ + -H "Authorization: token ACCESS_TOKEN" \ + -H "Content-Type: application/json" \ + -d '{"name":"REPO_NAME","description":"DESC","private":false}' +``` + +### Step 6: Initialize Git +```bash +git init +git add . +git commit -m "Initial commit" +git remote add origin git@GITEA_IP:username/repo.git +git push -u origin main +``` + +## API Reference + +### Gitea API Base +- URL: `http://GITEA_IP:PORT/api/v1` + +### Key Endpoints +- **Add SSH Key**: `POST /api/v1/user/keys` +- **Create Repo**: `POST /api/v1/user/repos` +- **List Repos**: `GET /api/v1/user/repos` +- **Get Repo**: `GET /api/v1/repos/{owner}/{repo}` + +See [references/gitea-config.md](references/gitea-config.md) for current server details and access tokens. + +## SSH Connection Test +```bash +ssh -T -p SSH_PORT git@GITEA_IP +# Expected: "Hi there, username! You've successfully authenticated..." +``` + +## Troubleshooting + +### SSH "Host key verification failed" +Add host to known_hosts: +```bash +ssh-keyscan -p SSH_PORT GITEA_IP >> ~/.ssh/known_hosts +``` + +### Git "Permission denied" +- Verify SSH key is added to Gitea +- Check ~/.ssh/config has correct port and user +- Test SSH connection with `ssh -T git@GITEA_IP` diff --git a/skills/gitea/references/gitea-config.md b/skills/gitea/references/gitea-config.md new file mode 100644 index 0000000..e2cef7f --- /dev/null +++ b/skills/gitea/references/gitea-config.md @@ -0,0 +1,146 @@ +# Gitea Configuration + +## Server Information + +- **Gitea URL**: http://192.168.120.110:4000/ +- **Repository URL**: http://192.168.120.110:4000/xiaohei/openclaw-workspace +- **SSH Host**: 192.168.120.110 +- **SSH Port**: 4022 +- **API Base**: http://192.168.120.110:4000/api/v1 + +## User Credentials + +- **Username**: xiaohei +- **Full Name**: 小黑 +- **Email**: xiaohei@foshanhuiya.com +- **Password**: n4wwxyv6 +- **Access Token**: 6699d6170be2d53b09517bff89ac27ecece2784e + +## SSH Configuration + +### SSH Key +- **Key Type**: ED25519 +- **Private Key**: ~/.ssh/id_ed25519 +- **Public Key**: ~/.ssh/id_ed25519.pub +- **Gitea Key ID**: 4 +- **Gitea Key Name**: OpenClaw-MacBook +- **Fingerprint**: SHA256:HT3VEaNgK1k2a3XplAMJ0WnL2u+K5qsHWcs2k1yDCHw + +### ~/.ssh/config +``` +Host 192.168.120.110 + HostName 192.168.120.110 + Port 4022 + User git + IdentityFile ~/.ssh/id_ed25519 +``` + +## Git Global Configuration + +```ini +[user] + name = xiaohei + email = xiaohei@foshanhuiya.com +``` + +## Repository Information + +### Remote Repository +- **Owner**: xiaohei +- **Repository Name**: openclaw-workspace +- **Private**: No +- **SSH URL**: git@192.168.120.110:xiaohei/openclaw-workspace.git +- **HTTP URL**: http://192.168.120.110:4000/xiaohei/openclaw-workspace.git +- **Default Branch**: main + +### Local Repository +- **Location**: /Users/hexcode/.openclaw/workspace +- **Remote**: origin +- **Current Branch**: main +- **Status**: Tracking origin/main + +## Initial Commit + +- **Commit Hash**: 3f93dbb +- **Message**: Initial commit: OpenClaw workspace setup +- **Files**: 13 files, 833 insertions + +## Gitignore + +Current .gitignore includes: +``` +# OpenClaw +.DS_Store +.venv/ +__pycache__/ +*.pyc + +# Node +node_modules/ +npm-debug.log + +# Logs +*.log + +# IDE +.vscode/ +.idea/ +*.swp +*.swo +``` + +## API Usage Examples + +### Create New Repository +```bash +curl -X POST "http://192.168.120.110:4000/api/v1/user/repos" \ + -H "Authorization: token 6699d6170be2d53b09517bff89ac27ecece2784e" \ + -H "Content-Type: application/json" \ + -d '{ + "name":"new-repo", + "description":"New repository", + "private":false, + "auto_init":false + }' +``` + +### List SSH Keys +```bash +curl -X GET "http://192.168.120.110:4000/api/v1/user/keys" \ + -H "Authorization: token 6699d6170be2d53b09517bff89ac27ecece2784e" +``` + +### Delete SSH Key +```bash +curl -X DELETE "http://192.168.120.110:4000/api/v1/user/keys/4" \ + -H "Authorization: token 6699d6170be2d53b09517bff89ac27ecece2784e" +``` + +## Common Workflows + +### Create and Push New Project +```bash +cd /path/to/project +git init +git add . +git commit -m "Initial commit" +git remote add origin git@192.168.120.110:xiaohei/repo-name.git +git push -u origin main +``` + +### Clone Existing Repository +```bash +git clone git@192.168.120.110:xiaohei/repo-name.git +``` + +### Push Changes +```bash +git add . +git commit -m "Update description" +git push +``` + +## Last Updated + +- **Date**: 2026-03-09 +- **Updated by**: OpenClaw workspace setup