gitea
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGitea
Gitea
Gitea is a self-hosted Git service. This skill uses the CLI to manage Gitea resources programmatically. All operations go through commands executed via Bash.
teateaGitea是一款自托管Git服务。本技能使用 CLI以编程方式管理Gitea资源。所有操作均通过Bash执行命令完成。
teateaImportant: Before Any Operation
重要提示:操作前须知
Run (from the skill directory) or manually verify:
bash scripts/check-tea.shbash
tea --version && tea logins lsIf is not installed, tell the user to install it ( on macOS, or see the tea repo). If no logins exist, guide them through .
teabrew install teareferences/authentication.md运行(从技能目录执行)或手动验证:
bash scripts/check-tea.shbash
tea --version && tea logins ls如果未安装,请告知用户进行安装(macOS系统使用,或查看tea仓库获取安装方式)。如果没有已配置的登录信息,请引导用户查看文档。
teabrew install teareferences/authentication.mdContext Detection
上下文检测
When inside a git repository, auto-detects the Gitea instance and repo from git remotes. Override with:
tea- to target a specific repository
--repo owner/repo - to use a specific Gitea login
--login name - to use a specific git remote
--remote name
Always check context first:
bash
git remote -v 2>/dev/null
tea logins ls --output simple当处于Git仓库目录中时,会自动从Git远程仓库信息中检测Gitea实例和仓库。可通过以下方式覆盖自动检测:
tea- :指定目标仓库
--repo owner/repo - :使用特定的Gitea登录信息
--login name - :使用特定的Git远程仓库
--remote name
请始终先检查上下文:
bash
git remote -v 2>/dev/null
tea logins ls --output simpleOutput Formatting
输出格式设置
Use () to control format:
--output-o- - best for parsing results programmatically
json - - compact, one value per line
simple - - human-readable (default)
table - /
csv/tsv- for data exportyaml
When processing results in scripts, prefer . When displaying to users, prefer .
--output json--output table使用(缩写)控制输出格式:
--output-o- :最适合以编程方式解析结果
json - :紧凑格式,每行一个值
simple - :适合人类阅读(默认格式)
table - /
csv/tsv:用于数据导出yaml
在脚本中处理结果时,优先使用。向用户展示结果时,优先使用。
--output json--output tableInstructions
操作指南
Issues
议题管理
List issues:
bash
tea issues ls # open issues in current repo
tea issues ls --state closed # closed issues
tea issues ls --labels bug,urgent # filter by labels
tea issues ls --assignee username # filter by assignee
tea issues ls --milestones "v1.0" # filter by milestone
tea issues ls --keyword "search term" # search by keyword
tea issues ls --fields "index,title,state,assignees,labels" --output tableCreate an issue:
bash
tea issues create --title "Bug: login fails" --description "Steps to reproduce..." --labels bug --assignees user1,user2Edit issues:
bash
tea issues edit 42 --title "New title" --add-labels enhancement --add-assignees user2
tea issues edit 42 --milestone "v2.0" --deadline 2025-12-31Close / reopen:
bash
tea issues close 42
tea issues reopen 42Add a comment:
bash
tea comment 42 "This is fixed in commit abc123"列出议题:
bash
tea issues ls # 当前仓库中的开放议题
tea issues ls --state closed # 已关闭的议题
tea issues ls --labels bug,urgent # 按标签筛选
tea issues ls --assignee username # 按经办人筛选
tea issues ls --milestones "v1.0" # 按里程碑筛选
tea issues ls --keyword "search term" # 按关键词搜索
tea issues ls --fields "index,title,state,assignees,labels" --output table创建议题:
bash
tea issues create --title "Bug: login fails" --description "Steps to reproduce..." --labels bug --assignees user1,user2编辑议题:
bash
tea issues edit 42 --title "New title" --add-labels enhancement --add-assignees user2
tea issues edit 42 --milestone "v2.0" --deadline 2025-12-31关闭/重新打开议题:
bash
tea issues close 42
tea issues reopen 42添加评论:
bash
tea comment 42 "This is fixed in commit abc123"Pull Requests
拉取请求管理
List PRs:
bash
tea pulls ls # open PRs
tea pulls ls --state closed --output json
tea pulls ls --labels "needs-review"Create a PR:
bash
tea pulls create --title "Add auth module" --description "Implements OAuth2 flow" --base main --head feature-branch
tea pulls create --title "Fix #42" --base main --head fix-login --labels bugfix --assignees reviewer1For fork-based PRs, use .
--head username:branchReview and merge:
bash
tea pulls review 15 # interactive review
tea pulls approve 15 # approve (alias: lgtm)
tea pulls reject 15 # request changes
tea pulls merge 15 --style squash # merge (styles: merge, rebase, squash, rebase-merge)
tea pulls merge 15 --style squash --title "feat: auth module (#15)" --message "Implements OAuth2"Checkout a PR locally:
bash
tea pulls checkout 15 # fetches and checks out PR branch
tea pulls clean 15 # delete local+remote branches after merge列出拉取请求:
bash
tea pulls ls # 开放的拉取请求
tea pulls ls --state closed --output json
tea pulls ls --labels "needs-review"创建拉取请求:
bash
tea pulls create --title "Add auth module" --description "Implements OAuth2 flow" --base main --head feature-branch
tea pulls create --title "Fix #42" --base main --head fix-login --labels bugfix --assignees reviewer1针对基于复刻仓库的拉取请求,使用。
--head username:branch审核与合并:
bash
tea pulls review 15 # 交互式审核
tea pulls approve 15 # 批准(别名:lgtm)
tea pulls reject 15 # 请求修改
tea pulls merge 15 --style squash # 合并(合并方式:merge、rebase、squash、rebase-merge)
tea pulls merge 15 --style squash --title "feat: auth module (#15)" --message "Implements OAuth2"在本地检出拉取请求:
bash
tea pulls checkout 15 # 获取并检出拉取请求分支
tea pulls clean 15 # 合并后删除本地和远程分支Repositories
仓库管理
List and search:
bash
tea repos ls # your repos on default login
tea repos search "keyword" # search across instance
tea repos search "keyword" --owner org # search within org
tea repos ls --output json --limit 50Create:
bash
tea repos create --name my-project --description "A new project" --init --gitignores Go --license MIT
tea repos create --name team-project --owner my-org --private
tea repos create-from-template --name new-proj --owner my-org # from template repoFork and clone:
bash
tea repos fork owner/repo
tea repos fork owner/repo --owner my-org # fork to org
tea clone owner/repo # clone (auto-detects login)Delete:
bash
tea repos delete --repo owner/repo # destructive - confirm with user firstMigrate from external source:
bash
tea repos migrate --name imported-repo --clone-url https://github.com/user/repo.git --service github --mirror列出与搜索仓库:
bash
tea repos ls # 默认登录账号下的仓库
tea repos search "keyword" # 在实例中搜索仓库
tea repos search "keyword" --owner org # 在指定组织内搜索
tea repos ls --output json --limit 50创建仓库:
bash
tea repos create --name my-project --description "A new project" --init --gitignores Go --license MIT
tea repos create --name team-project --owner my-org --private
tea repos create-from-template --name new-proj --owner my-org # 基于模板仓库创建复刻与克隆仓库:
bash
tea repos fork owner/repo
tea repos fork owner/repo --owner my-org # 复刻到指定组织
tea clone owner/repo # 克隆仓库(自动检测登录信息)删除仓库:
bash
tea repos delete --repo owner/repo # 破坏性操作 - 请先确认用户意图从外部源迁移仓库:
bash
tea repos migrate --name imported-repo --clone-url https://github.com/user/repo.git --service github --mirrorReleases
版本发布管理
List releases:
bash
tea releases lsCreate a release:
bash
tea releases create --tag v1.0.0 --title "Release 1.0.0" --note "Release notes here" --target main
tea releases create --tag v1.0.0 --title "v1.0.0" --note-file CHANGELOG.md --asset ./dist/binary.tar.gz
tea releases create --tag v2.0.0-rc1 --prerelease --draftEdit / delete:
bash
tea releases edit 1 --tag v1.0.1 --title "Patch Release"
tea releases delete 1 # destructive - confirm firstRelease assets:
bash
tea releases assets ls 1
tea releases assets create 1 ./path/to/file.zip
tea releases assets delete 1 asset-id列出版本发布:
bash
tea releases ls创建版本发布:
bash
tea releases create --tag v1.0.0 --title "Release 1.0.0" --note "Release notes here" --target main
tea releases create --tag v1.0.0 --title "v1.0.0" --note-file CHANGELOG.md --asset ./dist/binary.tar.gz
tea releases create --tag v2.0.0-rc1 --prerelease --draft编辑/删除版本发布:
bash
tea releases edit 1 --tag v1.0.1 --title "Patch Release"
tea releases delete 1 # 破坏性操作 - 请先确认版本发布资产管理:
bash
tea releases assets ls 1
tea releases assets create 1 ./path/to/file.zip
tea releases assets delete 1 asset-idLabels and Milestones
标签与里程碑管理
Labels:
bash
tea labels ls
tea labels create --name "priority:high" --color "#ff0000" --description "High priority"
tea labels update 5 --name "priority:critical" --color "#990000"
tea labels delete 5Milestones:
bash
tea milestones ls
tea milestones create --title "v2.0" --description "Major release" --deadline 2025-06-01
tea milestones close 3
tea milestones issues 3 # list issues in milestone标签:
bash
tea labels ls
tea labels create --name "priority:high" --color "#ff0000" --description "High priority"
tea labels update 5 --name "priority:critical" --color "#990000"
tea labels delete 5里程碑:
bash
tea milestones ls
tea milestones create --title "v2.0" --description "Major release" --deadline 2025-06-01
tea milestones close 3
tea milestones issues 3 # 列出里程碑下的议题CI/CD Actions
CI/CD操作
Workflow runs:
bash
tea actions runs ls # list recent runs
tea actions runs view 42 # view run details
tea actions runs logs 42 # view run logs
tea actions runs logs 42 --job 1 # specific job logs
tea actions runs logs 42 --follow # stream logs in real timeSecrets and variables:
bash
tea actions secrets ls
tea actions secrets create SECRET_NAME secret_value
tea actions secrets create DB_PASSWORD --file ./secret.txt
tea actions secrets delete SECRET_NAME
tea actions variables ls
tea actions variables set VAR_NAME var_value
tea actions variables delete VAR_NAMEWorkflows:
bash
tea actions workflows ls工作流运行:
bash
tea actions runs ls # 列出最近的运行记录
tea actions runs view 42 # 查看运行详情
tea actions runs logs 42 # 查看运行日志
tea actions runs logs 42 --job 1 # 查看指定任务的日志
tea actions runs logs 42 --follow # 实时流式查看日志密钥与变量:
bash
tea actions secrets ls
tea actions secrets create SECRET_NAME secret_value
tea actions secrets create DB_PASSWORD --file ./secret.txt
tea actions secrets delete SECRET_NAME
tea actions variables ls
tea actions variables set VAR_NAME var_value
tea actions variables delete VAR_NAME工作流:
bash
tea actions workflows lsOrganizations
组织管理
bash
tea orgs ls
tea orgs create --name my-org --description "My organization" --visibility public
tea orgs delete my-org # destructive - confirm firstbash
tea orgs ls
tea orgs create --name my-org --description "My organization" --visibility public
tea orgs delete my-org # 破坏性操作 - 请先确认Time Tracking
时间跟踪
bash
tea times ls 42 # time tracked on issue 42
tea times add 42 "2h30m" # log 2h30m on issue 42
tea times delete 42 1 # delete time entry
tea times reset 42 # reset all tracked timebash
tea times ls 42 # 查看议题42的跟踪时间
tea times add 42 "2h30m" # 为议题42记录2小时30分钟
tea times delete 42 1 # 删除时间条目
tea times reset 42 # 重置所有跟踪时间Notifications
通知管理
bash
tea notifications ls # unread + pinned
tea notifications ls --mine --states unread # across all repos
tea notifications read 1 # mark as read
tea notifications unread 1 # mark as unread
tea notifications pin 1 # pin notificationbash
tea notifications ls # 未读与已固定的通知
tea notifications ls --mine --states unread # 所有仓库中的未读通知
tea notifications read 1 # 标记为已读
tea notifications unread 1 # 标记为未读
tea notifications pin 1 # 固定通知Webhooks
Webhook管理
bash
tea webhooks ls
tea webhooks create --url https://example.com/hook --events push,pull_request --secret mysecret
tea webhooks update 1 --url https://new-url.com --events push
tea webhooks delete 1bash
tea webhooks ls
tea webhooks create --url https://example.com/hook --events push,pull_request --secret mysecret
tea webhooks update 1 --url https://new-url.com --events push
tea webhooks delete 1Direct API Access
直接API访问
For operations not covered by tea subcommands, use :
tea apibash
tea api /repos/{owner}/{repo} # GET (default)
tea api --method POST /repos/{owner}/{repo}/topics -f topic=ci # add topic
tea api /repos/{owner}/{repo}/commits --field sha=main # list commits
tea api --method DELETE /repos/{owner}/{repo}/topics/old-topic # delete topic{owner}{repo}references/workflows.md对于子命令未覆盖的操作,使用:
teatea apibash
tea api /repos/{owner}/{repo} # GET请求(默认)
tea api --method POST /repos/{owner}/{repo}/topics -f topic=ci # 添加主题
tea api /repos/{owner}/{repo}/commits --field sha=main # 列出提交记录
tea api --method DELETE /repos/{owner}/{repo}/topics/old-topic # 删除主题{owner}{repo}references/workflows.mdAdmin Operations
管理员操作
bash
tea admin users ls # list all users (admin only)bash
tea admin users ls # 列出所有用户(仅管理员可用)Examples
示例
Example 1: Bug report workflow
示例1:Bug报告流程
User says: "Create a bug report for the login timeout issue and assign it to alice"
bash
tea issues create --title "Bug: Login times out after 30s on slow connections" \
--description "## Steps to reproduce\n1. Connect via slow network\n2. Attempt login\n3. Observe timeout after 30s\n\n## Expected\nGraceful retry or extended timeout\n\n## Actual\nConnection dropped with no error message" \
--labels bug \
--assignees alice用户需求:"为登录超时问题创建Bug报告并分配给alice"
bash
tea issues create --title "Bug: Login times out after 30s on slow connections" \
--description "## 复现步骤\n1. 通过慢速网络连接\n2. 尝试登录\n3. 观察30秒后超时\n\n## 预期结果\n优雅重试或延长超时时间\n\n## 实际结果\n连接断开且无错误提示" \
--labels bug \
--assignees aliceExample 2: Release workflow
示例2:版本发布流程
User says: "Tag and release v2.1.0 with the changelog"
bash
tea releases create --tag v2.1.0 --title "v2.1.0" --note-file CHANGELOG.md --target main用户需求:"标记并发布v2.1.0版本,附带变更日志"
bash
tea releases create --tag v2.1.0 --title "v2.1.0" --note-file CHANGELOG.md --target mainExample 3: PR review and merge
示例3:拉取请求审核与合并
User says: "Check PR 27 and squash merge it if it looks good"
bash
tea pulls ls 27 --output json # inspect PR details
tea pulls approve 27 # approve
tea pulls merge 27 --style squash # squash merge用户需求:"检查PR 27,如果没问题就压缩合并"
bash
tea pulls ls 27 --output json # 检查PR详情
tea pulls approve 27 # 批准PR
tea pulls merge 27 --style squash # 压缩合并Example 4: Fork contribution workflow
示例4:复刻贡献流程
User says: "Fork the gitea/docs repo and create a PR for my typo fix"
bash
tea repos fork gitea/docs
tea clone gitea/docs
cd docs
git checkout -b fix-typo用户需求:"复刻gitea/docs仓库并为我的错别字修复创建PR"
bash
tea repos fork gitea/docs
tea clone gitea/docs
cd docs
git checkout -b fix-typo... user makes changes ...
... 用户进行修改 ...
git add -A && git commit -m "Fix typo in installation guide"
git push origin fix-typo
tea pulls create --title "Fix typo in installation guide" --base main --head yourusername:fix-typo
undefinedgit add -A && git commit -m "Fix typo in installation guide"
git push origin fix-typo
tea pulls create --title "Fix typo in installation guide" --base main --head yourusername:fix-typo
undefinedTroubleshooting
故障排除
Error: "No login configured"
错误:"No login configured"
Cause: No Gitea instance registered with tea.
Solution: Run or see for setup options including token, OAuth, and SSH authentication.
tea logins addreferences/authentication.md原因: 未向tea注册Gitea实例。
解决方案: 运行,或查看获取包括令牌、OAuth和SSH认证在内的设置选项。
tea logins addreferences/authentication.mdError: "Repository not found" or wrong repo detected
错误:"Repository not found"或检测到错误仓库
Cause: Git remote doesn't point to a known Gitea login, or repo slug is wrong.
Solution:
- Check remotes:
git remote -v - Specify explicitly:
tea issues ls --repo owner/repo --login mylogin - Verify login URL matches remote:
tea logins ls
原因: Git远程仓库未指向已知的Gitea登录信息,或仓库标识错误。
解决方案:
- 检查远程仓库:
git remote -v - 明确指定:
tea issues ls --repo owner/repo --login mylogin - 验证登录URL与远程仓库匹配:
tea logins ls
Error: "401 Unauthorized" or "403 Forbidden"
错误:"401 Unauthorized"或"403 Forbidden"
Cause: Token expired, insufficient scopes, or wrong login.
Solution:
- Check token validity:
tea whoami - Regenerate token with required scopes in Gitea web UI
- Update login:
tea logins edit
原因: 令牌过期、权限不足或登录信息错误。
解决方案:
- 检查令牌有效性:
tea whoami - 在Gitea网页UI中重新生成具有所需权限的令牌
- 更新登录信息:
tea logins edit
Error: "Connection refused"
错误:"Connection refused"
Cause: Gitea server unreachable.
Solution:
- Verify server URL:
tea logins ls - Check network/VPN connectivity
- For self-signed TLS:
tea logins add --insecure
原因: 无法连接到Gitea服务器。
解决方案:
- 验证服务器URL:
tea logins ls - 检查网络/VPN连接
- 对于自签名TLS证书:
tea logins add --insecure
Commands hang or return empty
命令挂起或返回空结果
Cause: API rate limiting or large result sets.
Solution: Use and for pagination:
--limit--pagebash
tea issues ls --limit 10 --page 1原因: API速率限制或结果集过大。
解决方案: 使用和进行分页:
--limit--pagebash
tea issues ls --limit 10 --page 1Additional References
额外参考
For detailed information, consult these bundled reference files:
- - Login setup, token scopes, multi-instance management, environment variables
references/authentication.md - - Complete flag and option reference for every tea subcommand
references/tea-commands.md - - Advanced multi-step workflows, tea api patterns, bulk operations
references/workflows.md
如需详细信息,请查阅以下附带的参考文档:
- - 登录设置、令牌权限、多实例管理、环境变量
references/authentication.md - - 所有tea子命令的完整参数和选项参考
references/tea-commands.md - - 高级多步骤流程、tea api模式、批量操作
references/workflows.md