Use gitlab personal access token instead of password with local git(cmd) in windows, incase two-factor authentication (2FA) is enabled in gitlab

In this post we will learn how we can use gitlab personal access token instead of a password with local git(cmd) in windows. This is needed incase you have two-factor authentication (2FA) enabled in gitlab. Follow the link to know about and create/revoke personal access token in gitlab.

  1. Once you have you personal access token, in windows,
    • go to Control Panel -> Credential Manager -> Windows Credentials.
  2. Find the credentials related to your git account and edit it.
  3. Replace your password with the personal access token you copied from gitlab.
  4. See below image for reference:
Git credentials settings in Windows Credentials

That’s it now git is using your personal access token instead of you password. Hope this helps 🙂

Subscription