Home > Blockchain >  Error with git push using new personal access token
Error with git push using new personal access token

Time:10-02

I am unable to push to git after generating a new personal access token. I've looked around at similar questions but think that I may have a more fundamental misunderstanding of how this works.

I got an email saying passwords were being phased out, so I generate a token and could no longer push a repo I've been working on using my password. From the instructions it looked like I can use the token just like a password, but to no avail. This is what the error looks like:

error message on command prompt

where I have pasted my token when prompted for password. (I've blacked out my username.) I am on Windows 10 and having checked my credentials manager do not appear to have credentials stored for github at the moment.

My questions are:

  1. Ideas for immediate convenient fixes? I was seeing some suggestions about setting the remote-url, but a little concerned about doing this for every repo I have. I'd like to change my workflow minimally, if possible.

  2. I'm probably grossly misunderstanding the point of the token. What is the "correct" way to set up a workflow to github? (Including maybe big changes that might take me a weekend to set up correctly, in a few weeks from now, say.) Am I supposed to set up a 2FA? (Will this change my web login at all?) Why is this more secure than a password? I've currently not setup SSH or anything else, really.

CodePudding user response:

I followed a similar workflow, generating a new token (in github.com/settings/tokens), and using it as password without issues.

I just made sure:

  • its scope included repo, workflow, gist and user. (you can update those scopes without regenerating the token)
  • its expiration date was either not set, or set to a date far enough to allow me to test/use it.

The resulting token should start with ghp_

ghp_DUvWjre....(ghp_ followed by 36 alphanumerical chars)

The OP Tommy Tang confirms in the comments:

I didn't find a previous credential, so I just added a generic credential on the manager, and it works.

  • Related