Using Git with Gitlab and second factor auth

Using Git with Gitlab and second factor auth

PROBLEM: After 2nd factor activation on Gitlab, username and password auth is not working anymore
SOLUTION: Generate API key and use modified url

Generate your API key on Gitlab

You can find this option in Preferences > Access Tokens
Copy this token and note you will see it only once (you have to generate a new one if the old is lost)

Create new URL

So if you would like to push or clone the repo using e.g. git clone, it should looks like this

Change .git/config

To keep remote origin, adjust file .git/config like this

or you can create new remote as well

but you have to use it when pushing like this

Working with IntelliJ IDEA/Webstorm

Just go to VCS > Git > Remotes… and change the URL of origin or add new remote and you should be fine 🙂

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments