GitLab API integration for repository operations. Use when working with GitLab repositories for reading, writing, creating, or deleting files, listing projects, managing branches, or any other GitLab repository operations.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install gitlab-api或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install gitlab-api⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/gitlab-api/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: gitlab-api description: GitLab API integration for repository operations. Use when working with GitLab repositories for reading, writing, creating, or deleting files, listing projects, managing branches, or any other GitLab repository operations. ---
Interact with GitLab repositories via the REST API. Supports both GitLab.com and self-hosted instances.
Store your GitLab personal access token:
mkdir -p ~/.config/gitlab
echo "glpat-YOUR_TOKEN_HERE" > ~/.config/gitlab/api_token
Token scopes needed: api or read_api + write_repository
Get a token:
Default instance: https://gitlab.com
For self-hosted GitLab, create a config file:
echo "https://gitlab.example.com" > ~/.config/gitlab/instance_url
GITLAB_TOKEN=$(cat ~/.config/gitlab/api_token)
GITLAB_URL=$(cat ~/.config/gitlab/instance_url 2>/dev/null || echo "https://gitlab.com")
curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
"$GITLAB_URL/api/v4/projects?owned=true&per_page=20"
Projects are identified by ID or URL-encoded path (namespace%2Fproject).
# By path
curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
"$GITLAB_URL/api/v4/projects/username%2Frepo"
# Extract ID from response: jq '.id'
PROJECT_ID="12345"
FILE_PATH="src/main.py"
BRANCH="main"
curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
"$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/files/${FILE_PATH}?ref=$BRANCH" \
| jq -r '.content' | base64 -d
PROJECT_ID="12345"
FILE_PATH="src/new_file.py"
BRANCH="main"
CONTENT=$(echo "print('hello')" | base64)
curl -X POST -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
-H "Content-Type: application/json" \
"$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/files/${FILE_PATH}" \
-d @- <<EOF
{
"branch": "$BRANCH",
"content": "$CONTENT",
"commit_message": "Add new file",
"encoding": "base64"
}
EOF
For updates, use -X PUT instead of -X POST.
curl -X DELETE -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
-H "Content-Type: application/json" \
"$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/files/${FILE_PATH}" \
-d '{"branch": "main", "commit_message": "Delete file"}'
curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
"$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/tree?path=src&ref=main"
curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
"$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/archive.tar.gz" \
-o repo.tar.gz
curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
"$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/branches"
curl -X POST -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
-H "Content-Type: application/json" \
"$GITLAB_URL/api/v4/projects/$PROJECT_ID/repository/branches" \
-d '{"branch": "feature-xyz", "ref": "main"}'
Use scripts/gitlab_api.sh for common operations:
# List projects
./scripts/gitlab_api.sh list-projects
# Read file
./scripts/gitlab_api.sh read-file <project-id> <file-path> [branch]
# Write file
./scripts/gitlab_api.sh write-file <project-id> <file-path> <content> <commit-msg> [branch]
# Delete file
./scripts/gitlab_api.sh delete-file <project-id> <file-path> <commit-msg> [branch]
# List directory
./scripts/gitlab_api.sh list-dir <project-id> <dir-path> [branch]
Full API docs: https://docs.gitlab.com/ee/api/api_resources.html
Key endpoints:
/api/v4/projects/api/v4/projects/:id/repository/files/api/v4/projects/:id/repository/tree/api/v4/projects/:id/repository/branches安装 GitLab API 后,可以对 AI 说这些话来触发它
Help me get started with GitLab API
Explains what GitLab API does, walks through the setup, and runs a quick demo based on your current project
Use GitLab API to gitLab API integration for repository operations
Invokes GitLab API with the right parameters and returns the result directly in the conversation
What can I do with GitLab API in my developer & devops workflow?
Lists the top use cases for GitLab API, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/gitlab-api/ 目录(个人级,所有项目可用),或 .claude/skills/gitlab-api/(项目级)。重启 AI 客户端后,用 /gitlab-api 主动调用,或让 AI 根据上下文自动发现并使用。
GitLab API 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
GitLab API 可免费安装使用。请查阅仓库了解许可证信息。
GitLab API integration for repository operations. Use when working with GitLab repositories for reading, writing, creating, or deleting files, listing projects, managing branches, or any other GitLab repository operations.
GitLab API 属于「Developer & DevOps」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my developer & devops tasks using GitLab API
Identifies repetitive steps in your workflow and sets up GitLab API to handle them automatically