How to Generate Personal Access Tokens in GitHub

Create GitHub personal access tokens for the command line
Tyler Tyler (258)
Total time: 5 minutes 

What are personal access tokens?

Personal access tokens are tokens that can be used to authenticate in lieu of a passphrase. They are often used on the command line or in applications with certain restrictions on authentication, and with GitHub specifically, they can be used instead of the passphrase when 2FA is enabled (which it should be). Personal access tokens provide extra security and convenience because they can be easily revoked without shutting down access to your account. Also, GitHub automatically removes unused access tokens after a year to help keep your account more secure.

In this guide, we'll learn how to generate personal access tokens in GitHub's web UI.

GitHub account settings.

Naturally, you'll need to log in to GitHub, and then click on your icon. A dropdown will appear. Click Settings in the dropdown.

GitHub personal access tokens developer settings.

In the left column you'll find an open called **Developer settings", click it.

GitHub personal access tokens page.

Next, click Personal access tokens in the left column.

GitHub personal access tokens generate new token.

On this page, you'll see a list of your existing access tokens, if any. Click the button that reads Generate new token.

GitHub personal access tokens name and scopes.

You'll be taken to a page to create a personal access token. Add a name and any scopes that are required for this particular token.

Keep in mind that you can create multiple tokens, and it's wise to use a single token for a specific purpose and create it with the minimum scope required.

Once you've provided a name and selected the minimum required scope, click Generate token.

GitHub personal access tokens copy token.

At this point, you should find your token. You can copy it, save it, and use it. You won't be able to find the token again, but you can regenerate, update, or delete it.