Skip to content
FunCoding

Search

Search docs, Skills and MCP

Origin CLI 安装与命令

使用 origin 管理仓库、认证、规则和 API,区分其环境变量与 Agent CLI。

This page has not been translated into English yet. The original Chinese version is shown below.

Origin CLI 使用 origin 可执行文件,支持 macOS、Linux 和 Windows WSL,独立于 agent。

curl -fsSL https://downloads.cursor.com/origin/install.sh | sh
origin --version
origin auth login

安装在 ~/.local/bin/origin,找不到命令时将 ~/.local/bin 加入 PATH。登录浏览器使用有 Origin 资格的 Cursor 账号,同时配置 Git credential helper。

认证

origin auth status 查看身份,auth setup-git 重设 helper,auth logout 清理已存凭据。login --local 把 helper 限在当前仓库,默认配置为全局。

CURSOR_API_KEY 已设且未给 --api-key 时,交互 login 询问是否改用 key,默认仍走浏览器;非交互 shell 自动用 key 并提示。CURSOR_AUTH_TOKEN 是直接使用的 bearer token,不同于登录 API key。

常用命令

命令作用
origin repo create my-project在账号 namespace 创建,默认 branch main
origin repo list列可访问仓库
origin repo clone acme/checkout使用保存的登录 clone
origin repo create-mirrored acme/checkout建立 GitHub 镜像
origin ruleset list读取 merge/push 规则集,别名 rs
origin ssh-key list查看已登记 SSH 公钥
origin update更新当前 release channel

repo delete 要完整 org/name;非交互删除须 --yes,不能仅传短名称。create-mirrored 可用 --namespace 指定目标,GHES 需 --github-enterprise-id。

仓库推断与 API

多数命令从 origin remote 推断仓库,-R/--repo 可给 org/name。origin api 请求公共 REST API,支持 --method、--header、--field、--raw-field、--input、--jq。

其 {owner}/{repo}/{branch} 从 -R、ORIGIN_REPO 或 remote 展开;ORIGIN_REPO 是无 origin remote 时的默认仓库。CURSOR_ORIGIN_ENDPOINT 默认 https://api.origin.cursor.com,而 origin api 文档指定的公共 REST base 是 https://api.cursor.com/v1/origin;两者用途不同,不自行给默认 endpoint 拼公共路径。

更新与帮助

默认 stable channel,可用 origin config set-channel latest 或 stable 切换,get-channel 查看。每个命令支持 --help;PR 参数见Pull requests。