How may I re-enable password login via git?

Hi,
I’ve been using password login via git, but the recent change prevents me from being able to log in via password, suggesting a token instead. Is there a setting allowing me to continue using password login? I’m not concerned with possible security impacts, since an account takeover would be a difficult endeavor without email access.
Thanks in advance.

2 Likes

No. You have to use a token for Git over HTTPS, or switch to SSH authentication.

Well that’s an unfortunate decision. Thanks anyway.

2 Likes

I think it was a good decision, for it protects your GitHub account from being hacked by separating its password from the login credential used in Git transactions over HTTP (which are susceptible to man-in-the-middle attacks). As for logging-into GitHub, the password benefits from an added security layer if you enable further authentication options.

1 Like

It seems that this cannot be changed.

How to fix the current repositories that stopped working on push?

1 Open settings → Developers → Personal access tokens > Create new token and copy
2 Open config file local repository nano .git/config

Edit Section

[remote "origin"]
        url = https://<TOKEN>@github.com/<USERNAME>/<REPOSITORY>.git
        fetch = +refs/heads/*:refs/remotes/origin/*
        gh-resolved = base

Save.

Then you can use push commands without a password.

I have seen not so much in my life. But this is reay useful and a great Idea.
Thank you

This way it will save your credentials inside the remote only, not in the credentials manager. The ideal approach is to associate your GitHub account credential to all GitHub URLs, i.e. by letting the credentials manager ask you the PAT once and store it henceforth.

Also, with your proposed system, if you have to change your PAT you’ll have to edit every single remote in every repository, which doesn’t sound practical nor DRY — unless your goal is indeed to use a specific PAT for each repository.

I just haven’t found another way to use tokens and fix the current local repositories.
it would be great if there were instructions for moving to tokens in a minimalistic form.

The problem is that credentials managements in Git can differ from one OS to another, and users are free to use alternative credential managers to the one shipped with the Git package for their OS. So a universal tutorial might not be easy to create. But here are a couple of links that might be useful: