SDK 使用 Gitea 管理开发
关于Gitea
Gitea 是一个轻量级的 DevOps 平台软件。从开发计划到产品成型的整个软件生命周期,他都能够高效而轻松的帮助团队和开发者。包括 Git 托管、代码审查、团队协作、软件包注册和 CI/CD。它与 GitHub、Bitbucket 和 GitLab 等比较类似。
Gitea的首要目标是创建一个极易安装,运行非常快速,安装和使用体验良好 的自建 Git 服务。
采用Go作为后端语言,只需生成一个可执行程序即可。 支持 Linux, macOS 和 Windows等多平台, 支持主流的x86,amd64、 ARM 和 PowerPC等架构。
安装配置 Gitea
请参考 Gitea - 安装 安装 Gitea 软件,官方文档详细的说明了安装方法和不同系统安装配置的方式。
note
note
备注
note
如果出现 error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413
请参考 Gitea - 反向代理 配置反向代理最大包大小,一般是上传工具链被截断
client_max_body_size 4096M;
:::
创建组织
点击加号,点击创建组织

然后新建一个组织,叫做 tina-v821

创建组织完成

安装 Gitea CLI
在下载了 SDK 的 Linux 环境中安装 Gitea CLI,安装方式:https://gitea.com/gitea/tea
wget https://dl.gitea.com/tea/0.10.1/tea-0.10.1-linux-amd64 -O tea
chmod 777 tea
sudo mv tea /usr/local/bin/
执行 tea 应该可以看到输出如下
tea - command line tool to interact with Gitea
version Version: main golang: 1.22.3
USAGE
tea command [subcommand] [command options] [arguments...]
DESCRIPTION
tea is a productivity helper for Gitea. It can be used to manage most entities on
one or multiple Gitea instances & provides local helpers like 'tea pr checkout'.
tea tries to make use of context provided by the repository in $PWD if available.
tea works best in a upstream/fork workflow, when the local main branch tracks the
upstream repo. tea assumes that local git state is published on the remote before
doing operations with tea. Configuration is persisted in $XDG_CONFIG_HOME/tea.
COMMANDS
help, h Shows a list of commands or help for one command
ENTITIES:
issues, issue, i List, create and update issues
pulls, pull, pr Manage and checkout pull requests
labels, label Manage issue labels
milestones, milestone, ms List and create milestones
releases, release, r Manage releases
times, time, t Operate on tracked times of a repository's issues & pulls
organizations, organization, org List, create, delete organizations
repos, repo Show repository details
comment, c Add a comment to an issue / pr
HELPERS:
open, o Open something of the repository in web browser
notifications, notification, n Show notifications
clone, C Clone a repository locally
MISCELLANEOUS:
whoami Show current logged in user
admin, a Operations requiring admin access on the Gitea instance
SETUP:
logins, login Log in to a Gitea server
logout Log out from a Gitea server
shellcompletion, autocomplete Install shell completion for tea
OPTIONS
--help, -h show help
--version, -v print the version
EXAMPLES
tea login add # add a login once to get started
tea pulls # list open pulls for the repo in $PWD
tea pulls --repo $HOME/foo # list open pulls for the repo in $HOME/foo
tea pulls --remote upstream # list open pulls for the repo pointed at by
# your local "upstream" git remote
# list open pulls for any gitea repo at the given login instance
tea pulls --repo gitea/tea --login gitea.com
tea milestone issues 0.7.0 # view open issues for milestone '0.7.0'
tea issue 189 # view contents of issue 189
tea open 189 # open web ui for issue 189
tea open milestones # open web ui for milestones
# send gitea desktop notifications every 5 minutes (bash + libnotify)
while :; do tea notifications --mine -o simple | xargs -i notify-send {}; sleep 300; done
ABOUT
Written & maintained by The Gitea Authors.
If you find a bug or want to contribute, we'll welcome you at https://gitea.com/gitea/tea.
More info about Gitea itself on https://about.gitea.com.
配置 Gitea 登录
输入 tea login add 进入登录配置
? URL of Gitea instance: xxx.com <- 输入 Gitea 的服务器地址/域名
? Name of new Login: (xxx.com) <- 不用改直接回车即可
? Login with: [Use arrows to move, type to filter] <- 一般选择 token 即可,也可以用 ssh-key,这里与 token 为例
> token
ssh-key/certificate
oauth
? Do you have an access token? (y/N) <- 选择 N 没有,让他生成 token
? Username: admin <- 输入用户名
? Password: **** <- 输入密码
? Token Scopes: [Use arrows to move, space to select, <right> to all, <left> to none, type to filter]
> [x] all <- 权限选择 ALL 即可,空格选中,回车
[ ] repo
[ ] repo:status
[ ] public_repo
[ ] admin:org
[ ] write:org
[ ] read:org
? OTP (if applicable) <- 没有 OTP 就回车,无视
? Set Optional settings: (y/N) <- 回车,不用配置
测试是否可以在目标仓库新建仓库
tea repo c --name test-repo -O tina-v821
成功输出如下:
tina-v821/test-repo (empty)
Issues: 0, Stars: 0, Forks: 0, Size: 22 Kb
Updated: 2025-07-01 04:02 (0s ago)
• Browse: http://xxx.com/tina-v821/test-repo
• Clone: git@xxx.com:tina-v821/test-repo.git
• Permission: admin
如果显示失败,请将用户添加到团队成员
Error: Given user is not allowed to create repository in organization.
点击组织,团队,添加团队成员即可
