The official GitLink(确实开源) CLI tool — built for humans and AI Agents. Supports macOS, Linux, and Windows. Covers repository management, issue tracking, pull requests, CI/CD, and AI-powered workflows, with 40+ commands and 11 AI Agent Skills.
Supported platforms: macOS, Linux, Windows (x64/arm64)
Go 1.21+ — only required for building from source
Quick Start (Human Users)
Note for AI assistants: If you are an AI Agent helping the user with installation, jump directly to Quick Start (AI Agent), which contains all the steps you need to complete.
Install
Choose one of the following methods:
Option 1 — From npm (recommended):
# Install CLI
npm install -g @gitlink-ai/cli
# Install CLI SKILL (required, works on all platforms)
gitlink-cli-install-skills
Option 2 — From source:
Requires Go 1.21+.
git clone https://www.gitlink.org.cn/Gitlink/gitlink-cli.git
cd gitlink-cli
make install
# Install CLI SKILL (required)
npx skills add ./skills -y -g
Windows 用户注意: 请在 PowerShell 或 CMD 中运行 npm install -g @gitlink-ai/cli。从源码构建请使用 go install . 代替 make install。
Configure & Use
# 1. Configure (one-time, interactive guided setup)
gitlink-cli config init
# 2. Log in (choose one)
gitlink-cli auth login # Username/password (recommended)
gitlink-cli auth login --token # Or paste a private token
export GITLINK_TOKEN="your-token" # Or set env var (for CI/CD, non-interactive environments)
# 3. Start using
gitlink-cli repo +list
Quick Start (AI Agent)
The following steps are for AI Agents. Some steps require the user to complete actions in a browser.
Step 1 — Install
# Install CLI
npm install -g @gitlink-ai/cli
# Install CLI SKILL (required, works on all platforms)
gitlink-cli-install-skills
Step 2 — Configure
gitlink-cli config init
Step 3 — Login
For interactive environments:
gitlink-cli auth login
For non-interactive environments (CI/CD, Trae sandbox, MCP, etc.):
export GITLINK_TOKEN="your-private-token"
To get a private token, go to GitLink web → Settings → Private Tokens.
获取私人令牌:GitLink 网页端 → 个人设置 → 私人令牌。
# GET 请求
gitlink-cli api GET /users/me
# POST 请求
gitlink-cli api POST /Gitlink/forgeplus/issues --body '{"subject":"test","description":"..."}'
# 带查询参数
gitlink-cli api GET /Gitlink/forgeplus/commits --query 'page=1&limit=5'
gitlink-cli
The official GitLink(确实开源) CLI tool — built for humans and AI Agents. Supports macOS, Linux, and Windows. Covers repository management, issue tracking, pull requests, CI/CD, and AI-powered workflows, with 40+ commands and 11 AI Agent Skills.
Install · AI Agent Skills · Auth · Commands · Contributing
Why gitlink-cli?
npmin one commandnpm installGITLINK_TOKENenv var, from install to first API call in just 3 stepsGITLINK_TOKENenv var for CI/CD & non-interactive environments, auto git remote context resolutionFeatures
Installation & Quick Start
Requirements
Before you start, make sure you have:
npm/npx) — for npm installationQuick Start (Human Users)
Install
Choose one of the following methods:
Option 1 — From npm (recommended):
Option 2 — From source:
Requires Go 1.21+.
Configure & Use
Quick Start (AI Agent)
Step 1 — Install
Step 2 — Configure
Step 3 — Login
For interactive environments:
For non-interactive environments (CI/CD, Trae sandbox, MCP, etc.):
Step 4 — Verify
使用示例
仓库操作
Issue 管理
Pull Request
发布管理
搜索
Raw API
Shortcuts 未覆盖的接口可通过 Raw API 直接调用:
全局参数
--owner--owner Gitlink--repo--repo forgeplus--format--format json--debug--debug自动上下文解析:在 git 仓库目录下,
--owner和--repo会自动从git remote origin解析。分支约定
gitlink-cli 支持 GitHub 和 GitLink 的代码双向同步:
mainmaster本地 push 到 GitLink:
AI Agent Skills
skills/目录包含 11 个 Claude Code Agent Skill 文件,支持 AI 自动化操作 GitLink 平台。详见 skills/README.md
gitlink-sharedgitlink-repogitlink-issuegitlink-prgitlink-branchgitlink-releasegitlink-orggitlink-cigitlink-searchgitlink-usergitlink-workflow项目结构
文档
常见问题
Q: 如何在脚本中使用 gitlink-cli?
A: 使用
GITLINK_TOKEN环境变量 +--format json获取结构化输出:Q: 如何自动解析 owner/repo?
A: 在 git 仓库目录下运行命令,CLI 会自动从
git remote origin解析:Q: Token 过期了怎么办?
A: 重新登录:
Q: 如何在 CI/CD 或非交互环境(Trae 沙箱等)中使用?
A: 设置
GITLINK_TOKEN环境变量即可,无需auth login:Token 优先级:
GITLINK_TOKEN环境变量 > keyring/文件存储的 token。不设置环境变量时完全兼容原有交互式登录。Priority:
GITLINK_TOKENenv var > keyring/file stored token. When env var is not set, the original interactive login flow works as before.Q: Windows 上凭证存储在哪里?
A: gitlink-cli 使用 Windows Credential Manager 安全存储 Token。如果 Credential Manager 不可用,会自动降级到文件存储 (
~/.config/gitlink-cli/credentials)。Q: 如何查看完整的 API 参考?
A: 查看 skills/gitlink-shared/REFERENCE.md
相关项目
许可证
Apache License 2.0