GitLab deploy key vs deploy token vs project access token: which to use

By Melih Toksari, developer of MergeBell · Updated · 4 min read

Short answer

A deploy key is an SSH key with read-only or read-write Git access to the projects it's enabled on, and nothing else. A deploy token is a username and token for HTTPS: it can clone, and pull or push container images and packages, for a project or a whole group, but it can't push code or use the general API. A project access token belongs to a bot user with a role and scopes, so it can push over HTTPS and call the API, but it expires, 365 days from creation unless you pick an earlier date, and on GitLab.com it needs Premium or Ultimate. In GitLab CI/CD jobs, try CI_JOB_TOKEN first.

A build server, deploy script or cluster needs GitLab access that doesn’t depend on your own account. GitLab has three credentials made for that: deploy keys, deploy tokens and project access tokens. Here’s how they differ in GitLab 19.5, which one to pick, and when a service account fits better.

At a glance

Deploy key Deploy token Project access token
What it is An SSH public key A username and token A token for a bot user
Git Clone over SSH, and push if given write access Clone over HTTPS Clone and push over HTTPS
Container registry No Pull and push Pull and push
Package registry No Pull and publish Pull and publish
GitLab API No Package endpoints only Yes
Reaches Each project it’s enabled on A project, or a group’s projects One project
Expires If you set a date If you set a date Yes, after 365 days by default
GitLab.com plans All All Premium and Ultimate

A group access token works like a project access token, for every project in a group.

Deploy keys

A deploy key is the public half of an SSH key pair you generate; the private key stays on the server that needs access. Add it under Settings › Repository › Deploy keys, with the Maintainer or Owner role:

  • It’s read-only unless you select Grant write permissions to this key.
  • You can enable the same key on other projects, even in other groups. On GitLab Self-Managed and Dedicated, an administrator can also add public deploy keys, which a Maintainer or Owner of any project can enable.
  • It’s tied to the user who created it. If that user is blocked, the key is rejected, and a push to a protected branch, with the pipeline it starts, needs that user to have access. If the user is removed from the project, the key keeps working until it’s revoked. GitLab recommends creating deploy keys from a service account.
  • It works only for Git over SSH: no HTTPS, registries or API.

Deploy tokens

A deploy token is a username and token that GitLab generates. Create one under Settings › Repository › Deploy tokens, in a project, with the Maintainer or Owner role, or in a group, as an Owner. Then pick its scopes:

  • read_repository to clone and pull over HTTPS. No scope lets it push code.
  • read_registry and write_registry for the container registry; pushing needs both.
  • read_package_registry and write_package_registry for packages.

The username is gitlab+deploy-token-<n> unless you choose one, and the token starts with gldt-. Use both to clone:

git clone https://<username>:<token>@gitlab.example.com/group/project.git

A deploy token named gitlab-deploy-token reaches the project’s CI/CD jobs as CI_DEPLOY_USER and CI_DEPLOY_PASSWORD. That suits something that pulls images long after the job ends, such as a Kubernetes cluster, since the job’s own token stops working when the job does.

Project access tokens

A project access token is a token for a bot user that GitLab adds to the project. Create one under Settings › Access tokens, with a role, from Guest to Owner, and scopes such as api, read_api, read_repository and write_repository. It works with:

  • The GitLab API, for its own project.
  • Git over HTTPS, with any non-blank username and the token as the password. With write_repository and the Developer role or higher, it can push.

It expires: if you don’t pick a date, 365 days after you create it, and by default you can’t pick a later one. On GitLab Self-Managed, an administrator can change both. On GitLab.com, it needs Premium or Ultimate; on GitLab Self-Managed and Dedicated, it comes with any license. Before one runs out, see GitLab token expiry and rotation.

Which one to use

  • A server pulls code over SSH, or pushes tags back: a deploy key, with write access only if it pushes.
  • A server or cluster pulls images or packages, or clones over HTTPS: a deploy token with only the scopes it needs.
  • A script calls the API, or pushes over HTTPS: a project access token. On GitLab.com’s Free plan, create a service account instead, up to 100 for each top-level group, and give it a personal access token with only the scopes it needs, rather than using your own: see GitLab token scopes explained.
  • A CI/CD job needs another project’s code, images or packages: the job token, CI_JOB_TOKEN, with no secret to store or rotate. See GitLab CI job token access.

On your phone

MergeBell uses none of these. It works on your merge requests and pipelines as you, so on gitlab.com you sign in on GitLab’s own page, and on self-managed GitLab with a personal access token with api. Deploy keys and tokens are for servers and scripts. More in GitLab token scopes explained.

Frequently asked questions

What's the difference between a GitLab deploy key and a deploy token?

A deploy key is the public half of an SSH key pair you generate, giving read-only or read-write Git access over SSH to each project it's enabled on. A deploy token is a username and token that GitLab generates, used over HTTPS to clone and to pull or push container images and packages, for one project or every project in a group. Neither can use the general GitLab API.

Can a GitLab deploy token push code?

No. Its only repository scope is read_repository, for cloning and pulling over HTTPS. To push code, use a deploy key with write access over SSH, or a project access token with write_repository and the Developer role or higher, over HTTPS. A deploy token can push container images and packages, with write_registry and write_package_registry.

Can I use a GitLab deploy token with the API?

Only with package registry endpoints, the ones with packages/ and a package format in the URL. For the rest of the API, use a project, group or personal access token with api or read_api.

Are GitLab project access tokens available on the Free tier?

On GitLab.com, project access tokens need Premium or Ultimate, and a trial allows one. On GitLab Self-Managed and GitLab Dedicated, they come with any license. Deploy keys and deploy tokens work on every tier.

Do GitLab deploy keys and deploy tokens expire?

Only if you set an expiry date when you create them. A deploy key also stops working if the user who created it is blocked. A project access token gets one either way: if you don't pick a date, 365 days after you create it, unless an administrator of a self-managed instance turned off Require expiration date.

Sources

Checked against these pages on 15 November 2026. GitLab changes quickly — if something here no longer matches, tell us and we will fix it.

Do this from your phone with MergeBell

Free for the whole review loop: the To-Do inbox, diffs and line comments, approve and merge, pipelines with retry, and push alerts for your To-Dos. Works with gitlab.com and self-managed GitLab 16.0+.

Get MergeBell for iPhoneGet MergeBell for Android

On the App Store for iOS 26 or later and on Google Play for Android 12 or later. An independent app, not affiliated with GitLab Inc.