gitea-tea
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGitea CLI (tea)
Gitea CLI (tea)
Overview
概述
Official command-line interface for Gitea. Manage issues, PRs, releases, and repos from terminal.
Gitea的官方命令行界面。可从终端管理Issue、PR、版本发布和仓库。
Instructions
使用说明
- Verify authentication: Run to confirm login
tea whoami - Check context: Run in git repo for auto-detection, or use
--repo owner/repo - Use non-interactive mode: Always use flag and provide all arguments
--output - Choose operation: See command reference sections below
- 验证身份认证:运行 确认登录状态
tea whoami - 检查上下文:在Git仓库中运行可自动检测,或使用 指定仓库
--repo owner/repo - 使用非交互模式:始终使用 标志并提供所有必要参数
--output - 选择操作:查看下方的命令参考章节
Installation
安装
bash
undefinedbash
undefinedmacOS
macOS
brew install tea
brew install tea
Linux (binary)
Linux(二进制包)
curl -sL https://dl.gitea.io/tea/main/tea-main-linux-amd64 -o tea
chmod +x tea && sudo mv tea /usr/local/bin/
curl -sL https://dl.gitea.io/tea/main/tea-main-linux-amd64 -o tea
chmod +x tea && sudo mv tea /usr/local/bin/
From source
从源码安装
go install code.gitea.io/tea@latest
undefinedgo install code.gitea.io/tea@latest
undefinedAuthentication
身份认证
bash
undefinedbash
undefinedInteractive login (recommended)
交互式登录(推荐)
tea login add
tea login add
Select: Application Token
选择:Application Token
Enter Gitea URL and token from User Settings → Applications
输入Gitea地址和从用户设置→应用中获取的token
List logins
列出登录信息
tea login list
tea login list
Set default
设置默认登录
tea login default gitea.example.com
tea login default gitea.example.com
Delete login
删除登录信息
tea login delete gitea.example.com
tea login delete gitea.example.com
Verify
验证
tea whoami
undefinedtea whoami
undefinedIssues
Issue管理
List Issues
列出Issue
bash
undefinedbash
undefinedOpen issues in current repo
当前仓库中的未关闭Issue
tea issues list
tea issues list
All issues (including closed)
所有Issue(包括已关闭)
tea issues list --state all
tea issues list --state all
Filter by milestone
按里程碑筛选
tea issues list --milestone "v1.0.0"
tea issues list --milestone "v1.0.0"
Filter by assignee and labels
按指派人及标签筛选
tea issues list --assignee username --label bug,critical
tea issues list --assignee username --label bug,critical
From specific repo
指定仓库的Issue
tea issues list --repo owner/repo --login gitea.com
undefinedtea issues list --repo owner/repo --login gitea.com
undefinedView Issue
查看Issue详情
bash
undefinedbash
undefinedView issue with comments
查看Issue及评论
tea issue 42
tea issue 42
Without comments
仅查看Issue内容(不含评论)
tea issue 42 --comments=false
tea issue 42 --comments=false
Open in browser
在浏览器中打开
tea open 42
undefinedtea open 42
undefinedCreate Issue
创建Issue
bash
undefinedbash
undefinedInteractive
交互式创建
tea issues create
tea issues create
With arguments
通过参数创建
tea issues create
--title "Fix authentication bug"
--body "Users cannot login with special characters"
--label bug,security
--assignee developer1
--milestone "v1.2.0"
--title "Fix authentication bug"
--body "Users cannot login with special characters"
--label bug,security
--assignee developer1
--milestone "v1.2.0"
tea issues create
--title "修复身份认证bug"
--body "用户无法使用特殊字符登录"
--label bug,security
--assignee developer1
--milestone "v1.2.0"
--title "修复身份认证bug"
--body "用户无法使用特殊字符登录"
--label bug,security
--assignee developer1
--milestone "v1.2.0"
From file
从文件读取内容创建
tea issues create
--title "Feature request"
--body "$(cat feature-request.md)"
--title "Feature request"
--body "$(cat feature-request.md)"
undefinedtea issues create
--title "功能需求"
--body "$(cat feature-request.md)"
--title "功能需求"
--body "$(cat feature-request.md)"
undefinedModify Issues
修改Issue
bash
undefinedbash
undefinedClose issue
关闭Issue
tea issues close 42
tea issues close 42
Reopen issue
重新打开Issue
tea issues reopen 42
tea issues reopen 42
Edit issue
编辑Issue
tea issues edit 42
--title "Updated title"
--assignee newdev
--add-labels "enhancement"
--title "Updated title"
--assignee newdev
--add-labels "enhancement"
undefinedtea issues edit 42
--title "更新后的标题"
--assignee newdev
--add-labels "enhancement"
--title "更新后的标题"
--assignee newdev
--add-labels "enhancement"
undefinedPull Requests
拉取请求(PR)管理
List PRs
列出PR
bash
undefinedbash
undefinedOpen PRs
未合并的PR
tea pulls
tea pulls
Closed PRs
已关闭的PR
tea pulls --state closed
tea pulls --state closed
Filter by reviewer and labels
按审核人及标签筛选
tea pulls --reviewer username --label "needs-review"
undefinedtea pulls --reviewer username --label "needs-review"
undefinedView PR
查看PR详情
bash
undefinedbash
undefinedView PR details
查看PR详细信息
tea pr 15
tea pr 15
Without comments
仅查看PR内容(不含评论)
tea pr 15 --comments=false
tea pr 15 --comments=false
Open in browser
在浏览器中打开
tea open 15
undefinedtea open 15
undefinedCreate PR
创建PR
bash
undefinedbash
undefinedInteractive
交互式创建
tea pulls create
tea pulls create
With arguments
通过参数创建
tea pulls create
--title "Implement user authentication"
--description "Adds OAuth and JWT support"
--base main
--head feature/auth
--assignee reviewer1,reviewer2
--label "enhancement"
--title "Implement user authentication"
--description "Adds OAuth and JWT support"
--base main
--head feature/auth
--assignee reviewer1,reviewer2
--label "enhancement"
tea pulls create
--title "实现用户身份认证"
--description "添加OAuth和JWT支持"
--base main
--head feature/auth
--assignee reviewer1,reviewer2
--label "enhancement"
--title "实现用户身份认证"
--description "添加OAuth和JWT支持"
--base main
--head feature/auth
--assignee reviewer1,reviewer2
--label "enhancement"
Description from file
从文件读取描述创建
tea pulls create
--title "Major refactor"
--description "$(cat pr-description.md)"
--title "Major refactor"
--description "$(cat pr-description.md)"
undefinedtea pulls create
--title "重大重构"
--description "$(cat pr-description.md)"
--title "重大重构"
--description "$(cat pr-description.md)"
undefinedCheckout PR
拉取PR到本地
bash
undefinedbash
undefinedCheckout PR locally
将PR拉取到本地
tea pulls checkout 20
tea pulls checkout 20
Custom branch name
指定自定义分支名
tea pulls checkout 20 pr-20-custom-name
tea pulls checkout 20 pr-20-custom-name
Clean up checked out PRs
清理已拉取的PR分支
tea pulls clean
undefinedtea pulls clean
undefinedReview & Merge
审核与合并PR
bash
undefinedbash
undefinedApprove PR
批准PR
tea pulls approve 20 --comment "LGTM!"
tea pulls approve 20 --comment "LGTM!"
Request changes
请求修改
tea pulls reject 20 --comment "Please add tests"
tea pulls reject 20 --comment "请添加测试用例"
Leave comment
添加评论
tea pulls review 20
--state comment
--comment "Consider refactoring this section"
--state comment
--comment "Consider refactoring this section"
tea pulls review 20
--state comment
--comment "考虑重构此部分"
--state comment
--comment "考虑重构此部分"
Merge PR (squash)
合并PR(压缩提交)
tea pulls merge 20 --style squash --message "feat: implement auth"
tea pulls merge 20 --style squash --message "feat: implement auth"
Merge PR (rebase)
合并PR(变基)
tea pulls merge 20 --style rebase
tea pulls merge 20 --style rebase
Close PR
关闭PR
tea pulls close 20
tea pulls close 20
Reopen PR
重新打开PR
tea pulls reopen 20
undefinedtea pulls reopen 20
undefinedReleases
版本发布管理
List Releases
列出版本发布
bash
tea releases list
tea releases list --limit 10
tea releases list --repo owner/projectbash
tea releases list
tea releases list --limit 10
tea releases list --repo owner/projectCreate Release
创建版本发布
bash
undefinedbash
undefinedBasic release
基础版本发布
tea releases create v1.0.0
--title "Version 1.0.0"
--note "First stable release"
--title "Version 1.0.0"
--note "First stable release"
tea releases create v1.0.0
--title "Version 1.0.0"
--note "首个稳定版本"
--title "Version 1.0.0"
--note "首个稳定版本"
From changelog file
从变更日志文件读取说明
tea releases create v1.2.0
--title "Version 1.2.0"
--note-file CHANGELOG.md
--title "Version 1.2.0"
--note-file CHANGELOG.md
tea releases create v1.2.0
--title "Version 1.2.0"
--note-file CHANGELOG.md
--title "Version 1.2.0"
--note-file CHANGELOG.md
Draft release
创建草稿版本
tea releases create v2.0.0-beta
--title "Beta Release"
--draft
--note "Beta for testing"
--title "Beta Release"
--draft
--note "Beta for testing"
tea releases create v2.0.0-beta
--title "Beta版本"
--draft
--note "供测试用的Beta版本"
--title "Beta版本"
--draft
--note "供测试用的Beta版本"
With assets
附带资产文件的版本发布
tea releases create v1.1.0-rc1
--title "Release Candidate 1"
--prerelease
--asset dist/binary-linux-amd64
--asset dist/binary-darwin-amd64
--title "Release Candidate 1"
--prerelease
--asset dist/binary-linux-amd64
--asset dist/binary-darwin-amd64
tea releases create v1.1.0-rc1
--title "Release Candidate 1"
--prerelease
--asset dist/binary-linux-amd64
--asset dist/binary-darwin-amd64
--title "Release Candidate 1"
--prerelease
--asset dist/binary-linux-amd64
--asset dist/binary-darwin-amd64
Create tag + release
创建标签并发布版本
tea releases create v1.3.0
--target main
--title "Version 1.3.0"
--note "New features"
--target main
--title "Version 1.3.0"
--note "New features"
undefinedtea releases create v1.3.0
--target main
--title "Version 1.3.0"
--note "新增功能"
--target main
--title "Version 1.3.0"
--note "新增功能"
undefinedEdit/Delete Release
编辑/删除版本发布
bash
undefinedbash
undefinedUpdate release
更新版本发布信息
tea releases edit v1.0.0
--title "Version 1.0.0 - Updated"
--note-file NEW-NOTES.md
--title "Version 1.0.0 - Updated"
--note-file NEW-NOTES.md
tea releases edit v1.0.0
--title "Version 1.0.0 - 更新版"
--note-file NEW-NOTES.md
--title "Version 1.0.0 - 更新版"
--note-file NEW-NOTES.md
Publish draft
发布草稿版本
tea releases edit v2.0.0 --draft=false
tea releases edit v2.0.0 --draft=false
Delete release
删除版本发布
tea releases delete v0.9.0
tea releases delete v1.0.0-beta --confirm
undefinedtea releases delete v0.9.0
tea releases delete v1.0.0-beta --confirm
undefinedLabels
标签管理
bash
undefinedbash
undefinedList labels
列出标签
tea labels list
tea labels list --repo owner/project
tea labels list --save # Save labels to file
tea labels list
tea labels list --repo owner/project
tea labels list --save # 将标签保存到文件
Create label
创建标签
tea labels create bug
--color "#ff0000"
--description "Something isn't working"
--color "#ff0000"
--description "Something isn't working"
tea labels create enhancement
--color "0,255,0"
--description "New feature"
--color "0,255,0"
--description "New feature"
tea labels create bug
--color "#ff0000"
--description "功能异常"
--color "#ff0000"
--description "功能异常"
tea labels create enhancement
--color "0,255,0"
--description "新增功能"
--color "0,255,0"
--description "新增功能"
Update label
更新标签
tea labels update bug --color "#cc0000"
tea labels update old-name --name new-name
tea labels update bug --color "#cc0000"
tea labels update old-name --name new-name
Delete label
删除标签
tea labels delete bug
undefinedtea labels delete bug
undefinedMilestones
里程碑管理
bash
undefinedbash
undefinedList milestones
列出里程碑
tea milestones list
tea milestones list --state open
tea milestones list --state closed
tea milestones list
tea milestones list --state open
tea milestones list --state closed
View milestone issues
查看里程碑关联的Issue
tea milestones issues "v1.0.0"
tea milestones issues "v1.0.0" --kind pull # Only PRs
tea milestones issues "v1.0.0" --state all
tea milestones issues "v1.0.0"
tea milestones issues "v1.0.0" --kind pull # 仅查看PR
tea milestones issues "v1.0.0" --state all
Add issue/PR to milestone
为里程碑添加Issue/PR
tea milestones issues add "v1.0.0" 42
tea milestones issues add "v1.0.0" 42
Remove issue/PR from milestone
从里程碑移除Issue/PR
tea milestones issues remove "v1.0.0" 42
tea milestones issues remove "v1.0.0" 42
Create milestone
创建里程碑
tea milestones create "v2.0.0"
--description "Major version release"
--deadline "2024-12-31"
--description "Major version release"
--deadline "2024-12-31"
tea milestones create "v2.0.0"
--description "大版本发布"
--deadline "2024-12-31"
--description "大版本发布"
--deadline "2024-12-31"
Close milestone
关闭里程碑
tea milestones close "v1.0.0"
tea milestones close "v1.0.0"
Reopen milestone
重新打开里程碑
tea milestones reopen "v1.0.0"
tea milestones reopen "v1.0.0"
Delete milestone
删除里程碑
tea milestones delete "v0.9.0"
undefinedtea milestones delete "v0.9.0"
undefinedRepositories
仓库管理
bash
undefinedbash
undefinedList repos
列出仓库
tea repos list
tea repos list --org myorg
tea repos list --watched # Watched repos
tea repos list --starred # Starred repos
tea repos list --type fork # Filter: fork, mirror, source
tea repos list --output yaml
tea repos list
tea repos list --org myorg
tea repos list --watched # 已关注的仓库
tea repos list --starred # 已标星的仓库
tea repos list --type fork # 筛选:复刻、镜像、源仓库
tea repos list --output yaml
Search repos
搜索仓库
tea repos search "keyword" --login gitea.com
tea repos search "keyword" --login gitea.com
View repo details
查看仓库详情
tea repos owner/repo
tea repos owner/repo
Create repo
创建仓库
tea repos create --name myrepo --private --init
tea repos create
--name myrepo
--owner myorg
--description "My project"
--private
--init
--gitignores Go
--license MIT
--name myrepo
--owner myorg
--description "My project"
--private
--init
--gitignores Go
--license MIT
tea repos create --name myrepo --private --init
tea repos create
--name myrepo
--owner myorg
--description "我的项目"
--private
--init
--gitignores Go
--license MIT
--name myrepo
--owner myorg
--description "我的项目"
--private
--init
--gitignores Go
--license MIT
Create from template
从模板创建仓库
tea repos create-from-template
--template owner/template-repo
--name new-repo
--template owner/template-repo
--name new-repo
tea repos create-from-template
--template owner/template-repo
--name new-repo
--template owner/template-repo
--name new-repo
Fork repo
复刻仓库
tea repos fork --repo owner/repo
tea repos fork --repo owner/repo --owner myorg
tea repos fork --repo owner/repo
tea repos fork --repo owner/repo --owner myorg
Delete repo
删除仓库
tea repos delete owner/repo
tea repos delete owner/repo
Clone repo (without git)
克隆仓库(无需git命令)
tea clone owner/repo
tea clone owner/repo ./target-dir
tea clone gitea.com/owner/repo # With host
undefinedtea clone owner/repo
tea clone owner/repo ./target-dir
tea clone gitea.com/owner/repo # 指定主机
undefinedTime Tracking
时间追踪
bash
undefinedbash
undefinedList time entries
列出时间条目
tea times list
tea times list --issue 42
tea times list --user username
tea times list --from "2024-01-01" --until "2024-12-31"
tea times list
tea times list --issue 42
tea times list --user username
tea times list --from "2024-01-01" --until "2024-12-31"
Add time
添加时间记录
tea times add 42 --time "2h"
tea times add 42 --time "1h30m" --message "Implemented auth logic"
tea times add 42 --time "2h"
tea times add 42 --time "1h30m" --message "实现身份认证逻辑"
Delete entry
删除时间条目
tea times delete 42 --id 123
undefinedtea times delete 42 --id 123
undefinedNotifications
通知管理
bash
undefinedbash
undefinedList notifications (current repo)
列出通知(当前仓库)
tea notifications list
tea notifications list
List all notifications
列出所有个人通知
tea notifications list --mine
tea notifications list --mine
Filter by type
按类型筛选
tea notifications list --types issue,pull
tea notifications list --types issue,pull
Filter by state
按状态筛选
tea notifications list --states unread,pinned
tea notifications list --states unread,pinned
Mark as read
标记为已读
tea notifications read # All filtered
tea notifications read 123 # Specific ID
tea notifications read # 所有筛选出的通知
tea notifications read 123 # 指定ID的通知
Mark as unread
标记为未读
tea notifications unread 123
tea notifications unread 123
Pin/unpin
固定/取消固定
tea notifications pin 123
tea notifications unpin 123
undefinedtea notifications pin 123
tea notifications unpin 123
undefinedOrganizations
组织管理
bash
undefinedbash
undefinedList organizations
列出组织
tea organizations list
tea organizations list
View organization details
查看组织详情
tea organizations myorg
tea organizations myorg
Create organization
创建组织
tea organizations create myorg
tea organizations create myorg
Delete organization
删除组织
tea organizations delete myorg
undefinedtea organizations delete myorg
undefinedBranches
分支管理
bash
undefinedbash
undefinedList branches
列出分支
tea branches list
tea branches list --output json
tea branches list
tea branches list --output json
View branch details
查看分支详情
tea branches main
tea branches main
Protect branch
保护分支
tea branches protect main
tea branches protect main
Unprotect branch
取消分支保护
tea branches unprotect main
undefinedtea branches unprotect main
undefinedComments
评论管理
bash
undefinedbash
undefinedAdd comment to issue or PR
为Issue或PR添加评论
tea comment 42 "This is my comment"
tea comment 42 "这是我的评论"
From specific repo
指定仓库添加评论
tea comment 42 "Comment text" --repo owner/repo
undefinedtea comment 42 "评论内容" --repo owner/repo
undefinedAdmin (requires admin access)
管理员操作(需要管理员权限)
bash
undefinedbash
undefinedList users
列出用户
tea admin users list
tea admin users list --output json
undefinedtea admin users list
tea admin users list --output json
undefinedNon-Interactive Mode (AI Agents)
非交互模式(AI Agent适用)
IMPORTANT: When using tea in AI agent environments (no TTY), avoid interactive prompts:
bash
undefined重要提示:在AI Agent环境(无TTY)中使用tea时,需避免交互式提示:
bash
undefinedUse --output to disable interactive mode
使用--output禁用交互模式
tea issues --output simple
tea pulls --output json
tea issues --output simple
tea pulls --output json
Provide ALL required arguments upfront
提前提供所有必要参数
tea issue create --title "Bug title" --body "Description here"
tea pr create --title "PR title" --head feature-branch --base main
tea issue create --title "Bug标题" --body "问题描述"
tea pr create --title "PR标题" --head feature-branch --base main
Use -y or --yes for confirmations
使用-y或--yes自动确认
tea pr merge 5 --yes
tea releases delete v0.9.0 --yes
tea pr merge 5 --yes
tea releases delete v0.9.0 --yes
Set default login to avoid prompts
设置默认登录以避免提示
tea login default <login-name>
**Always prefer explicit flags over interactive prompts.**tea login default <login-name>
**始终优先使用显式标志而非交互式提示。**Guidelines
操作准则
Do
建议
- Use or
--output simplefor non-interactive mode--output json - Provide all required arguments upfront to avoid prompts
- Run to verify authentication before operations
tea whoami - Use to quickly view in browser
tea open <number>
- 在非交互模式下使用 或
--output simple--output json - 提前提供所有必要参数以避免提示
- 执行操作前运行 验证身份认证状态
tea whoami - 使用 快速在浏览器中查看
tea open <number>
Don't
不建议
- Use interactive commands in AI agent context (no TTY)
- Forget when outside git repository
--repo owner/repo - Skip flag for destructive operations in scripts
--yes - Use interactively (configure beforehand)
tea login add
- 在AI Agent环境中使用交互式命令(无TTY)
- 在Git仓库外操作时忘记指定
--repo owner/repo - 在脚本中执行破坏性操作时省略 标志
--yes - 以交互方式使用 (提前配置好)
tea login add
Examples
示例
Example: Feature Branch → PR
示例:功能分支→PR
bash
git checkout -b feature/new-featurebash
git checkout -b feature/new-feature... make changes ...
... 进行代码修改 ...
git add . && git commit -m "feat: add new feature"
git push -u origin feature/new-feature
tea pulls create --title "Add new feature" --base main --head feature/new-feature
undefinedgit add . && git commit -m "feat: add new feature"
git push -u origin feature/new-feature
tea pulls create --title "添加新功能" --base main --head feature/new-feature
undefinedExample: Review & Merge PR
示例:审核并合并PR
bash
tea pulls checkout 20bash
tea pulls checkout 20... review code ...
... 审核代码 ...
tea pulls approve 20 --comment "LGTM!"
tea pulls merge 20 --style squash
undefinedtea pulls approve 20 --comment "LGTM!"
tea pulls merge 20 --style squash
undefinedExample: Create Release with Assets
示例:创建附带资产的版本发布
bash
git tag v1.0.0
git push origin v1.0.0
tea releases create v1.0.0 \
--title "v1.0.0" \
--note-file CHANGELOG.md \
--asset dist/app-linux \
--asset dist/app-darwinbash
git tag v1.0.0
git push origin v1.0.0
tea releases create v1.0.0 \
--title "v1.0.0" \
--note-file CHANGELOG.md \
--asset dist/app-linux \
--asset dist/app-darwin