返回顶部
g

giteeGitee操作

Gitee operations via OpenAPI and git: repositories, pull requests, issues, comments, and file contents. Use when: (1) inspecting or creating Gitee pull requests, (2) listing or creating repository issues, (3) reading repository files from the Gitee API, (4) working with gitee.com remotes from the terminal. NOT for: GitHub-only workflows, local-only git tasks with no Gitee interaction, or browser-only account setup and SSO flows.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
432
下载量
免费
免费
1
收藏
概述
安装方式
版本历史

gitee

Gitee 技能

使用 git 进行克隆、获取、分支和推送操作。使用 curl + jq 进行结构化的 Gitee API 调用。

何时使用

使用此技能的场景:

  • - 检查 Gitee 的拉取请求、分支或仓库元数据
  • 列出或创建 Gitee 仓库中的议题
  • 通过 Gitee API 读取仓库文件
  • 在没有专用 CLI 的情况下,从终端自动化 Gitee 工作流

何时不使用

不要使用此技能的场景:

  • - 处理 GitHub 仓库 → 使用 github 技能
  • 仅进行本地 git 操作,无需与 Gitee 交互 → 直接使用 git
  • 处理仅限浏览器的流程,如登录、验证码或 SSO 授权

设置

  1. 1. 创建一个具有所需仓库权限的 Gitee 个人访问令牌。
  2. 导出 API 基础 URL 和令牌:

bash
export GITEE_API=https://gitee.com/api/v5
export GITEEACCESSTOKEN=...

  1. 3. 切勿将令牌打印、提交或粘贴到聊天中。仅将其保留在环境变量或配置中。

远程仓库模式

常见的 Gitee 远程仓库:

text
https://gitee.com/owner/repo.git
git@gitee.com:owner/repo.git

检查当前仓库:

bash
git remote -v
git remote get-url origin

API 约定

  • - Gitee OpenAPI 示例通常将 OAuth2 凭据作为 access_token 传递。
  • 优先使用 curl -fsS,以便 HTTP 错误能清晰显示。
  • 优先使用 jq -nc 构建 JSON 请求体,而不是手动转义字符串。
  • 仓库议题 API 与 GitHub 不同:许多议题路由使用 /repos/{owner}/issues,并将仓库名称作为 repo 字段传递。

常用命令

拉取请求

列出开放的拉取请求:

bash
OWNER=owner
REPO=repo

curl -fsS --get $GITEE_API/repos/$OWNER/$REPO/pulls \
--data-urlencode accesstoken=$GITEEACCESS_TOKEN \
--data-urlencode state=open |
jq .[] | {number, title, state, author: .user.login}

查看单个拉取请求:

bash
PR_NUMBER=12

curl -fsS --get $GITEEAPI/repos/$OWNER/$REPO/pulls/$PRNUMBER \
--data-urlencode accesstoken=$GITEEACCESS_TOKEN

创建拉取请求:

bash
HEAD_BRANCH=feature-branch
BASE_BRANCH=main
TITLE=feat: add gitee support
BODY=Summary of the change

curl -fsS -X POST $GITEE_API/repos/$OWNER/$REPO/pulls \
-H Content-Type: application/json \
-d $(jq -nc \
--arg accesstoken $GITEEACCESS_TOKEN \
--arg title $TITLE \
--arg head $HEAD_BRANCH \
--arg base $BASE_BRANCH \
--arg body $BODY \
{accesstoken: $accesstoken, title: $title, head: $head, base: $base, body: $body}) |
jq {number, title, html_url, state}

议题

列出仓库的议题:

bash
curl -fsS --get $GITEE_API/repos/$OWNER/issues \
--data-urlencode accesstoken=$GITEEACCESS_TOKEN \
--data-urlencode repo=$REPO \
--data-urlencode state=open |
jq .[] | {number, title, state}

创建议题:

bash
TITLE=Bug: unexpected failure
BODY=Steps to reproduce...

curl -fsS -X POST $GITEE_API/repos/$OWNER/issues \
-H Content-Type: application/json \
-d $(jq -nc \
--arg accesstoken $GITEEACCESS_TOKEN \
--arg repo $REPO \
--arg title $TITLE \
--arg body $BODY \
{accesstoken: $accesstoken, repo: $repo, title: $title, body: $body}) |
jq {number, title, state, html_url}

仓库内容

读取文件:

bash
FILE_PATH=README.md

curl -fsS --get $GITEEAPI/repos/$OWNER/$REPO/contents/$FILEPATH \
--data-urlencode accesstoken=$GITEEACCESS_TOKEN

创建或更新文件内容时,使用相同的路径并配合 POST 或 PUT。使用 jq -nc 构建 JSON 请求体,并包含端点所需的提交消息和内容字段。

Git 传输

从 Gitee 克隆:

bash
git clone https://gitee.com/$OWNER/$REPO.git

推送当前分支:

bash
git push origin HEAD

添加专用的 Gitee 远程仓库:

bash
git remote add gitee git@gitee.com:$OWNER/$REPO.git
git push gitee HEAD

有用的 jq 过滤器

开放 PR 标题:

bash
jq -r .[] | #\(.number) \(.title)

议题编号和链接:

bash
jq -r .[] | #\(.number) \(.html_url)

注意事项

  • - 当需要结构化元数据、过滤或自动化时,优先使用 API 调用。
  • 当需要分支、提交、克隆、获取或推送操作时,优先使用 git。
  • Gitee OpenAPI 文档:https://gitee.com/api/v5/swagger
  • 如果此处缺少某个操作,请在 OpenAPI 文档中查找,并保持相同的 access_token + curl 模式。

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 gitee-1776096249 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 gitee-1776096249 技能

通过命令行安装

skillhub install gitee-1776096249

下载

⬇ 下载 gitee v1.0.0(免费)

文件大小: 2.55 KB | 发布时间: 2026-4-15 12:54

v1.0.0 最新 2026-4-15 12:54
Initial release of the Gitee skill with OpenAPI and git support.

- Enables listing, creating, and inspecting Gitee pull requests and issues.
- Provides commands for reading Gitee repository contents using the API.
- Supports git operations (clone, fetch, push) for gitee.com remotes.
- Includes usage guidelines, setup instructions, and common API workflows.
- Requires `curl`, `git`, `jq`, and a Gitee personal access token.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部