Deploy Center Docs Guides GitHub Download

GitLab as a source

Last updated · Edit on GitHub

On this page

Deploy Center counts what is merged but not live: the commits between the live commit and the branch, the merge requests among them, and the merge requests still open. For a project whose repo is on GitLab (gitlab.com or your own GitLab) it now reads GitLab for this, the same way it reads GitHub. The app needs no change: vercel json, render json, changed --json and details give the same fields for both.

Set up#

Either of these works. With both, glab is used.

glab (the GitLab CLI):

brew install glab
glab auth login

For a self-managed GitLab, log in with glab auth login --hostname git.example.com.

A token, without glab: a personal access token with the read_api scope, kept in the macOS keychain. It is tried on GITLAB_HOST first and saved only when GitLab takes it:

pbpaste | deploys gitlab set-token     # deploys gitlab forget-token removes it

GITLAB_TOKEN still works and wins over the keychain (for CI or Linux), but it puts the token in plain text in your shell profile.

For a self-managed GitLab, also say where it is:

export GITLAB_HOST=git.example.com

The token is sent only to GITLAB_HOST (gitlab.com when unset), never to another host a repo URL names, and it goes to curl on stdin, so it never shows in the process list. The app starts the script from launchd, which does not read your shell profile: put the variables where the app's login-shell PATH comes from (~/.zprofile), or use glab, whose login is stored by glab itself.

Check it:

deploys doctor

gitlabCli says whether glab is installed, gitlabLoggedIn whether glab is logged in to GITLAB_HOST or GITLAB_TOKEN is accepted there. deploys where shows the GitLab user.

Which repos count as GitLab#

Each platform says where a project deploys from. Vercel's Git link has a type (github, gitlab); Render gives the repo URL. In the JSON, .repo is:

Repo.repo
GitHubowner/name, as before
gitlab.comgitlab.com/group/subgroup/name
Self-managed GitLabgit.example.com/group/name

A host is GitLab when it is gitlab.com, the host in GITLAB_HOST, one listed in DEPLOYS_GITLAB_HOSTS (several hosts, spaces between), or has gitlab in its name. Any other host (Bitbucket, Gitea, ...) is neither: those projects stay "branch head unknown", as before.

What is read#

All reads go to https://<host>/api/v4/projects/<group%2Fname>/, through glab api --hostname <host> or curl.

WhatGitLab APISame as on GitHub
Branch headrepository/commits/<branch>repos/…/commits/<branch>
Commits waitingrepository/compare?from=<live>&to=<branch>compare/<live>...<branch>
Ahead, behind, divergedrepository/merge_base of both; when live is not an ancestor, the comparison the other way gives behindBystatus, behind_by
Merged MRs in that rangeSee merge request group/name!12 or (!12) in the message; for up to 10 commits without one, repository/commits/<sha>/merge_requests (merged only). Each MR is counted once.(#12), Merge pull request #12, commits/<sha>/pulls
Open MRsmerge_requests?state=opened&per_page=100; drafts from draft, bots by name (Renovate, Dependabot, project_…_bot, …-bot)pulls?state=open
Details: commits and authorsthe comparison: author_name, committed_date, web_urlauthor.login, commit.committer.date
Details: files and linesthe comparison's diffs; + and - lines countedfiles[].additions, deletions
Details: CI of the branch headrepository/commits/<sha>/statuses: one per job; failed/canceled failed, running/pending/created runningcheck runs

Differences from GitHub#

Vercel projects on GitLab#

Turning auto-deploy off (deploys vercel autodeploy-off) remembers a GitLab link as {"type":"gitlab","repo":"gitlab.com/group/name","projectId":…,"ref":…}, and deploys vercel deploy then sends Vercel a GitLab gitSource with that project id. For a project disconnected before, say where it deploys from:

deploys vercel map web gitlab.com/group/name main

This looks up the project id on GitLab, so glab or GITLAB_TOKEN must work for that host.

Without lib/githost.sh#

The GitLab code lives in lib/githost.sh, next to deploys (and inside the app, under Contents/Resources/lib/). An older copy of deploys alone, without that folder, still reads GitHub as before; GitLab projects then stay "branch head unknown".