Skip to content

How to authenticate to GitHub using username and password

New Course Coming Soon:

Get Really Good at Git

I was setting up a new editor and I was trying the GitHub push workflow.

I committed my changes, pressed “Push” and I got a dialog window to enter my GitHub username and password.

On GitHub I have 2FA set up, so you can’t just login using those credentials.

What I had to do was create a personal access token that’s tied to the app, with the permission needed.

So I went to the GitHub settings, located Developer Settings:

Clicked Personal access tokens:

Now add a name so you’ll remember what this token is for, set the expiration to “No expiration” and enable the repo scope. That’s the only one you need:

Save and you’ll be able to see the token.

Now enter this token as the password in the username/password dialog window.

You’re set.

Are you intimidated by Git? Can’t figure out merge vs rebase? Are you afraid of screwing up something any time you have to do something in Git? Do you rely on ChatGPT or random people’s answer on StackOverflow to fix your problems? Your coworkers are tired of explaining Git to you all the time? Git is something we all need to use, but few of us really master it. I created this course to improve your Git (and GitHub) knowledge at a radical level. A course that helps you feel less frustrated with Git. Launching Summer 2024. Join the waiting list!

Here is how can I help you: