Files
opencode/command/gitea-create-repo.md
voson 43e138b19e feat: 新增对话总结命令与浏览器自动化技能
- 本地化命令描述(英文→中文)

- 删除未使用命令文件

- 新增 summarize-conversation 命令

- 更新 AI 模型配置为 DeepSeek

- 新增 agent-browser 技能

- 重构技能目录结构(重命名)
2026-01-15 17:30:39 +08:00

2.7 KiB

description
description
在 Gitea 上创建新的 Git 仓库

Create a new Git repository on Gitea via API.

工作目录

macOS / Linux:

~/.config/gitea/

Windows:

%USERPROFILE%\.config\gitea\

配置文件从该目录加载。

User input format:

$ARGUMENTS = [<owner>/]<repo> [private|public]

Examples:

  • my-project - Private repo under default org or current user
  • ai/my-project - Private repo under ai organization
  • ai/my-project public - Public repo under ai organization
  • username/test private - Private repo under username

Please perform the following:

  1. Load configuration:

macOS / Linux:

source ~/.config/gitea/config.env

Windows PowerShell:

Get-Content "$env:USERPROFILE\.config\gitea\config.env" | ForEach-Object {
    if ($_ -match '^([^=]+)=(.*)$') {
        [Environment]::SetEnvironmentVariable($matches[1], $matches[2], 'Process')
    }
}
  • If not exists: prompt to run /gitea-reset
  1. Parse user input from $ARGUMENTS:

    • Extract: owner (optional), repo (required), visibility (optional, default: private)
    • If no owner specified:
      • Use GITEA_DEFAULT_ORG if set
      • Otherwise get current user from API: GET /api/v1/user
    • Validate repo name: only letters, numbers, underscores, hyphens, dots
  2. Create repository via API:

    • Try organization API first:
      POST ${GITEA_URL}/api/v1/orgs/${owner}/repos
      Body: {
        "name": "${repo}",
        "private": true/false,
        "auto_init": false,
        "default_branch": "main"
      }
      
    • If 404, try user API: POST /api/v1/user/repos
    • Handle response codes:
      • 201: Success
      • 409: Repository already exists
      • 404: Owner not found or no permission
      • Other: API error
  3. Extract repository info from response:

    • html_url - Web URL
    • clone_url - HTTPS URL
    • ssh_url - SSH URL
  4. Ask user if they want to add remote:

    • Check if current directory is a git repo
    • If not, ask to initialize: git init
    • Check if origin remote exists
    • Add or update remote: git remote add/set-url origin <clone_url>
  5. Display result in Chinese:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
仓库创建成功
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  名称:       [owner]/[repo]
  可见性:     [private/public]
  Web URL:    [html_url]
  HTTPS URL:  [clone_url]
  SSH URL:    [ssh_url]

Notes:

  • Requires repo creation permission in token
  • Organization and user repositories use different API endpoints
  • Default branch is main (not master)