remote: Invalid username or password. Git Push.

Here is the situation, I cloned a repository from some server and start to work on local, everything was fine until I have to send all my work to prod on this server. From the server, I pulled all the code from my Github repo, some conflicts were found and I fixed, everything well until I pushed all these changes to my Github repo from the server. I was prompted to insert my Github username and password, but it didn’t work!!

This was the error I got:

$ git Push Origin master
Username for '': fernastereo
Password for '': 
remote: Invalid username or password.
fatal: Authentication failed for ''

Ok, what is going on here??? I know my username, I know my password, what is wrong then??

The thing is I was using https URL and, according to Github, when you enable 2FA, you must insert a personal access token instead of 2FA code and your Github password. Ok, not a big deal. But, How can I generate this access token?? Let’s see…

On Github, click your profile photo, then click Settings.

Click on Developer settings from the sidebar on the left.

Click on Personal access tokens. (again, sidebar on the left)

Click Generate new token.

Write a descriptive note for your token and select the scopes or permissions, you’d like to grant. To use your token to access repositories from the command line, select repo.

Click on Generate Token and copy the token to your clipboard, since you will not be able to see the token again.

Now, with the access token, I tried to push again my changes to my Github repository, one more time, I was prompted to insert my Github username and password, but this time instead of writing my password I paste the access token I had created before and voilà!!! Problem solved!!!

2 comentarios sobre “remote: Invalid username or password. Git Push.

  1. Good post. I learn something tougher on totally different blogs everyday. It will always be stimulating to learn content material from different writers and observe a bit something from their store. I抎 prefer to make use of some with the content on my weblog whether you don抰 mind. Natually I抣l provide you with a hyperlink on your net blog. Thanks for sharing.

Deja un comentario