Skip to content
FLAVIO COPES
flaviocopes.com
2026

How to authenticate to GitHub using username and password

By Flavio Copes

Learn how to authenticate to GitHub when username and password no longer work, by creating a personal access token with repo scope to use as the password.

~~~

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:

GitHub settings sidebar with Developer settings option highlighted

Clicked Personal access tokens:

GitHub Developer settings page showing Personal access tokens section with Generate new token button

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:

New personal access token form with note field, expiration dropdown, and scopes list including repo scope

Token expiration set to No expiration with repo scope checked and enabled for full control of private repositories

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

Personal access tokens list showing the newly created Nova editor token with repo scope and no expiration date

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

You’re set.

Tagged: Git · All topics
~~~

Related posts about git: