Push problem with console (maybe 2fa)

Im new with git, i dont know if it matthers, but im in new in linux also.

How i push until yesterday, i go my console, git push, put my Username and Password, and its done. no issue here.
But, Today I recibe an email that says using password to access my repository will be deprecated, that i need to do a “Two-factor authentication”.

I did the Two-factor authentication (i have the 16 lines code), so now i want to push from console like i use to, but…
Username for “my”
Password for “my” (i checked the password)
remote: Invalid username or password.
fatal: Autenticación fails to ‘https://github.com/myName/myRepository.git/

The question its how push to my repository now ?? (i dont want use visual studio code).

You need to create a PAT (personal access token) and use that instead of the password. You’ll need the repo scope, and possibly workflow if you use Github Actions (see Available scopes).

Or alternatively you can use SSH instead of HTTPS.

thanks airtower-luna. The PAT thing works.

Maybe i need to make another question, but i give it a shot here…
I dont want remember this 40 characters token (i believe that git f*** up hugh here).
Is any chante to set it up account and token/password in my console and do “git push” and the console dont ask anything ??

I try this
“git config --global credential.helper store”

and this using the token as a password
“git config --global user.name “your username””
“git config --global user.password “your password””
But none work…

The user.* settings have nothing to do with authentication, they are about author information in commits. And user.password isn’t a valid setting at all, so it won’t be used (and I strongly recommend you delete it immediately for security).

I can’t say much about the git credential helpers, I just use SSH. But in general I strongly advise against storing the token unencrypted. The best option is to use a password manager that stores your passwords in an encrypted database (I like KeePassXC), so you have to remember only one password, and of course keep the database backed up. The cache credential helper plus a password manager might be a good compromise.

And I´m goingo to start using KeePassXC… It seems a good “solution”.
And i will read more about SSH.

Thanks for share information, i also delete the user.* staffs

Don’t delete all the user.* settings, those are important. Just the user.password one isn’t. :wink: