top of page
Search
  • Writer's pictureShamodya Hashantha

Working with TWO factor authentication enabled GIT repo

Updated: Jul 26, 2021

Hello guys,


Here I come with another #hashnote. This is also a pretty simple trick for a small problem that you would face. But it can become a terrible headache if you wouldn't resolve it immediately. So let’s get into works

Recently I enabled two-factor authentication for my git account. Then I tried to clone a repo from my organization and it prompted my username and password on the command line. However, even I gave the correct credentials it gave me an “Authentication failed ” error message as below. I tried several times with correct credentials but the authentication failure was kept as the same.



So what can we do for eliminating this problem and successful login?. There is a pretty easy trick that can use in here for successful authentication. Instead of using a normal git account password, you can use a personal access token (PAT) which will grant you from git. This PAT resolves the authentication issue. So next obvious question. How can we obtain a PAT from git? Don’t worry! It’s a piece of cake. What do you need to do is follow simple steps as below.

First, click the “Settings” which expands after clicking your profile photo at the top right corner.



Then click on the“Developer settings” which shows on the left side bar.


Then click on the “Personal access token” as below and it will redirect to a page where included a “Generate access token” link


Name the PAT and give the permissions accordingly.


Then you can generate a PAT. And this PAT can use the authentication password when credentials prompting.


Hope this #hashnote will help you and let's meet on another #hashnote.

In the next one, I'll discuss how to configure SSO for "GitHub" with the WSO2 identity server.


Until then happy coding!

cheers!




3 views0 comments

Comments


Post: Blog2_Post
bottom of page