2 minute read

You’re coding. You’re in the flow. You’re banging code out at the speed of light. You’re building the software that is going to change the world. You git add and git commit. You’re on fire. You’re unstoppable. You’re hackerman.

Then you try to git push

 âžś  git push
Username for 'https://github.com': Rainymood
Password for 'https://Rainymood@github.com':
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/Rainymood/foobar.git/'

What the hell?

Everyone, PANIC!

What the hell just happened?

Honestly, I have no idea what just happened and why it happened. All I know is that I’ve had this problem before and that my credentials sometimes randomly just start failing when they feel like it.

Now you have to gather the last remaining pieces of self-worth you can find around you on the floor and bash your head against a wall again to figure out what the fuck went wrong and how to fix it.

Step 1: Your username

First, we have to figure out what your user name is.

Let’s consult git config to figure out your user name.

 âžś  git config user.name
Jan Meppe

WRONG!

This is not your username. This is your user name.

Step 2: Your password

Second, we need to figure out your password.

If you are not a savage and use a password manager you can find your password for Github there.

WRONG! AGAIN!

This is not your password. If at some point in the past, you used this thing called a personal access token, then that token is your password. But you probably forgot about that, didn’t you? (I for sure fucking did.)

Go to Settings > Developer settings > Personal access tokens

Basically if you use any scripts that have this token hardcoded somewhere in there will be absolutely fucked. Thankfully, I’m not such an idiot (I hope).

Regenerate the token for this particular device.

And now this is your password

Moment of truth

We have our correct user name and correct password (personal access token). Let’s try this shit again.

 âžś  git push
Username for 'https://github.com': Rainymood
Password for 'https://Rainymood@github.com':
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 4 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 2.31 KiB | 2.31 MiB/s, done.
Total 6 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.

YEEEEEES!!! IT WORKS!

This is what it feels to be in a love-hate relationship with an inanimate thing. Stupid fucking git I hate you. At the same time you work seamlessly 100% of the time 60% of the time.

Stupid silly git.

Update: Still getting asked for your credentials every time?

If you are, even after all this trouble, still getting asked for your credentials, follow along!

First, delete the current credentials explained here

$ git credential-osxkeychain erase
host=github.com
protocol=https
> [Press Return]

Then, follow the steps outlined here.

Do you see this little lock icon?

Right click on it and make sure it is locked.

Finally, if you now try to push or pull you will be prompted to fill in your computer password.

Done! Your credentials are now stored. All is well now.

Subscribe

Comments