GitLab - Git Clone with MFA Enabled
Instructions to login into GitLab when 2FA is enabled
A. Create an Access Token:
- Log in into the GitLab account;
- Go to the Preferences section (hover the profile image and wait for the menu).
- Go to Access Tokens
- Now here you can create a temporary token; if you need to pull/push you must enable read_repository and write_repository flags.
- A token is shown in the page. Don’t close or refresh the page, or you won’t be able to retrieve the same token again!!!
B. Clone the Repository
- Open a terminal and run the git clone command with https:
1
git clone https://<gitlab-server-name>/<gitlab-repository>.git
- Once you press enter, you will be prompted for password
- Paste the Personal Access Token (PAT) that you created above and the repo should be cloned.
OR
- Clone the repository using git clone https://oauth2:
@gitlab.com/ / .git
This post is licensed under CC BY 4.0 by the author.