This is why I had to face this two-factor issue: the GitHub announcement
1 Answers
I've seen many links regarding this problem but, because info is scattered, I decided to make a summary with steps that worked for me.
First of all, here is the best link I've found on how to set the two-factor security in github.com
Here is what I set for my token (If you select less rights than required, the access fails too, no matter the token is ok)
The key here is to use the new token INSTEAD of your user password. But because I'm just fetching all changes from my github.com repos, I've saved the credentials on local. I must admit this is NOT recommendable because security (in Linux, this is set in plain text, that is a very bad practice), but here we goes ...
Here is the link about how to set git credentials on local
Now, here is where you must set your credentials: file is ~/.git-credentials
yyyyyy@xxxxxx:~$ cat .git-credentials
https://put-your-github-user-here:put-yout-token-here@github.com
Another example on what to do in this file
Here is a link about the format for this file
After setting all this stuff, try to check the repo status or fetch any changes to local.

- 318
- 2
- 11
-
Thank you hgc2002 for your suggestions. You should set the rights of the credentials file to user-read-only, no group- or public access. We have the same problem here: github only describes the 2FA for Windows and Mac, not for Linux. We want still be able to use the command-line. – peets May 12 '21 at 09:21
-
I could not solve the problem yet well, so I will use the old 1FA until they throw me out and then will change my provider who supports Linux in his user-guide, except someone can give me a working solution here. btw: can someone give me an experience which alternative to github can be used which is easy to migrate and allows non-commercial less frequent use? – peets May 12 '21 at 09:21
-
(note: I can not understand why somebody voted this question down, it is also essential here and no suitable answer was found yet. If you are a SuperTroll please keep away from SO.com. At least you could post a reason for your weird action) – peets May 12 '21 at 09:21