GitLab 与 Self-Hosted
配置 GitLab OAuth 应用、仓库同步与自托管网络,理解删除连接保留的内容。
GitLab 集成支持 Cloud Agents 与 Bugbot。官方当前要求付费 GitLab Premium 或 Ultimate,因为依赖 project access tokens;不能把 GitLab Free 当作已支持的接入套餐。
GitLab.com
需要 Cursor admin 和 GitLab maintainer。在 Dashboard > Integrations 连接 GitLab,完成授权后打开 Manage > Sync Repos,再为同步的仓库配置功能。Disconnect Account 用于断开账号。
Self-Hosted 前提
Cursor 需 Teams 或 Enterprise,GitLab 实例管理员负责创建应用。实例需安全入站接受 Cursor API/Git 访问,并允许出站 webhook;入站 IP 按官方当前列表配置。
创建与注册应用
- 在 GitLab 创建应用,官方优先建议 instance level。
- Redirect URI 设为
https://cursor.com/gitlab-connected。 - Trusted 和 Confidential 都设为 true,scopes 为 api、write_repository。
- 保存 Application ID 与 Secret。
- 在 Cursor Integrations > Advanced > GitLab Self-Hosted 填 hostname、ID 和 Secret,点击 Register。
- 选择实例并 Connect,随后 Manage > Sync Repos。
若需私网,Enterprise 可与 Cursor 协调 PrivateLink、Cloudflare Tunnel;GitLab 专题还列有需联系支持的 reverse proxy tunnel,不提供可自行猜测的部署参数。当前不支持客户自行使用 Google PSC。
删除实例的实际影响
在 Advanced > GitLab Self-Hosted 的实例菜单选 Delete Instance,会移除 OAuth 凭据、webhook secret、服务账号/用户 token 和 Cursor 创建的 webhook。Bugbot 仓库设置、团队设置及 learned rules 会保留,重新连接相同 hostname 时恢复。
这与只断开个人账号不同。需要将 GitLab group/namespace 锁定到 Cursor 组织时使用 Protected Git Scopes,要求 GitLab Owner。