Back to Desktop

Authenticating to GitLab with GitHub Desktop

docs/integrations/gitlab.md

latest2.8 KB
Original Source

Authenticating to GitLab with GitHub Desktop

GitHub Desktop now provides support for Git Credential Manager (GCM), which makes the task of authenticating to GitLab repositories easy and secure. This feature can be enabled by going to File > Options > Advanced on Windows, or GitHub Desktop > Preferences > Advanced on macOS, and then selecting the Use Git Credential Manager checkbox.

When GCM is enabled all credentials for GitLab will be handled, and stored, outside of GitHub Desktop. GCM supports browser authentication and will avoid the need to create personal access tokens (PATs).

The prompt to authenticate to your GitLab account using GCM will be shown after you enter the HTTPS clone URL of the GitLab repository by going to File > Clone Repository > URL.

If you would prefer not to use GCM and need to create a personal access token in GitLab you can follow the steps below.

Creating a Personal Access Token in GitLab

To authenticate against GitLab repositories you will need to create a personal access token.

  1. Go to your GitLab account and select Edit Profile in the user profile dropdown.

  1. In the left sidebar, select Access tokens

  2. Under Add a personal access token choose a name and set an expiration date for your token.

  3. For Scopes select api to ensure that GitHub Desktop has the correct read/write access to your GitLab repositories.

  4. Click Create personal access token to create a new token, and then copy the token to your clipboard.

Cloning your GitLab repository in GitHub Desktop

  1. Open GitHub Desktop and go to File > Clone Repository > URL. Enter the Git URL of your GitLab repository. Make sure you enter the correct URL, which should have the following structure:

    https://gitlab.com/<username>/<repository>

  2. You will receive an Authentication Failed error. Enter your GitLab username and paste in the token you just copied to your clipboard as your password. Click Save and Retry to successfully clone the repository to your local machine in GitHub Desktop.

  • Note: Your GitLab credentials will be securely stored on your local machine so you will not need to repeat this process when cloning another repository from GitLab.