How to Get Personal Access Token on GitHub?

How to Get Personal Access Token on GitHub?

As a developer, you know that a secure app needs a solid authentication system. GitHub is no different, and if you want to access GitHub via their API or while using the command line, you’ll need what’s called a personal access token.

This access token is like a password, but more secure. In fact, it is designed specifically so that you don’t have to use a password over HTTPS connections. 

But where can you find the Personal Access Token on GitHub? 

You might need an access token for various tasks, such as linking external applications using the GitHub API, or connecting to GitHub via an IDE or text editor. However, the initial occasion where you might be prompted for a personal access token is when you push your code to a remote repository for the first time using the command line. 

The error often reads, “support for password authentication was removed on August 13, 2021. Please use a personal access token instead.”

If this is the first time you’re hearing of a GitHub personal access token, then you won’t have a clue where it is, because the command line doesn’t usually come right out and tell you.

Let’s fix that!

Open Your GitHub Developer Settings

Click the profile in the upper right-hand corner and select Settings from the drop-down menu.

Then just head on over to Developer Settings on the left.

On the next screen, you have options for setting up new GitHub or OAuth apps. But what we’re after is the access token. You’ll find those at the bottom of the sidebar on the left.

Unless you’re an organization or enterprise user, the fine-grained personal access token is not going to offer many benefits. We’re going to stick with the tried-and-true classic token.

Generate Your New Token

You won’t have to do any heavy lifting. Just click the Generate new token button and specify classic from the drop-down.

Give Your Token a Name and Scope

On the next screen, you can give your new token a name, and check any boxes for various scope parameters. You can set some pretty fine-grained permissions from the options here, so check out the official documentation from GitHub to determine the best scope for your use case.

When you’re done, just hit Generate token, and that’s it!

What you do with your shiny new token is up to you. Check out my other GitHub articles for more tips and suggestions. Leave a comment if you have any questions!