📅 23 Feb 2021
It has been in the works for some time, but I kept procrastinating adding 2FA to my Github. Here is the official announcement from Github:
OK, great. I’m not going to walk through how to set-up 2FA. It is very easy to do through the settings on your Github profile.
What is not as self-explanatory (but still easy), is once enabled, how you use the CLI to perform common Git operations (pull, push, etc.)
See, once you enable 2FA and then try to use terminal, you will get an error:
OK, so now we need to fix this. To do so, we will generate a personal access token.
** Note: this is a guide for mac. **
First, navigate over to the settings page of your Github profile.
Next, click on the developer settings on the left side navigation menu:
Next, select personal access tokens:
Next, select generate new token:
Then, we will give our personal access token a name. I chose something simple:
Finally, we need to select the scope of this token. For git push, pull, etc., we only need to select the top option:
Once that is done, copy the access token. Now, we can navigate back to the terminal. Once there, try another git push/pull. You should get the same error. Without closing the terminal, run the same command again. This should bring up the validation in your terminal. Now, you can enter your username and for password, use the access token you just generated.
And, voilà! You should be all set.
I hope this helps someone.
Day 30: #100DaysToOffload
💬 Looking for comments?
I don't have comments on this site because I don't feel like managing them.
Instead of leaving a comment, feel free to ✉️ contact me instead.