DEV Community

Cover image for How to create a Personal Access Token - GitHub
Davide 'CoderDave' Benvegnù
Davide 'CoderDave' Benvegnù

Posted on • Edited on

How to create a Personal Access Token - GitHub

If you want to create a new GitHub Personal Access Token but you don't know where to start, this article is for you!

Intro

Today we talk about GitHub Personal Access Tokens, PATs, and how to create them.

Personal access tokens (PATs) are an alternative to using passwords for authentication to GitHub when using the GitHub APIs, the command line, or any integration really.

Although their creation is pretty straight forward, most people either don't know where to start or, as it happens to me all the time 😅, just forget about it...

Let's do it.

Video

As usual, if you are a visual learner, or simply prefer to watch and listen instead of reading, here you have the video with the whole explanation and demo, which to be fair is much more complete than this post.

(Link to the video: https://youtu.be/SzrETQdGzBM)

If you rather prefer reading, well... let's just continue :)

Create a PAT

To create a PAT, just go to your profile menu in the upper right corner > Settings > Developer Settings > and finally click on Personal Access Tokens.

menu

Here you have the list of all the PATs you've created, together with the date you last used them.

Now just click on the Generate new token button, select the Scope, click Generate Token and you're done.

New PAT

IMPORTANT: after generating a token, you will see the token itself. Be sure to copy this value because it will disappear as soon as you leave or refresh the page and you will never be able to retrieve it again.

Authorize a PAT for SSO

If you want to use a PAT to access resources owned by an organization that uses SAML SSO, you must authorize the PAT.

SSO

Click on the "Enable SSO" button next to a token and then on "Authorize" for the organization you want to enable. Easy, right?

Final note: As a security precaution, GitHub automatically removes personal access tokens that haven't been used in a year.

Announcement

Before closing, I have an announcement to make, which I'm very excited about. I've finally launched my Patreon page. You can get exclusive content, both posts and videos that are not posted anywhere else. You can influence the content of this blog and my YouTube channel, you can have live chats and Q&A with me. But the coolest part is that you can have a 1:1 consultation with me to talk about anything DevOps, GitHub or Azure DevOps.

Visit my Patreon page to see the options available, just go to patreon.com/CoderDave.

Patreon

Conclusions

Now you should be able to create any PAT you need in GitHub. Let me know in the comment section below if you have any questions about this.

Like, share and follow me 🚀 for more content:

📽 YouTube
Buy me a coffee
💖 Patreon
👕 Merch
👦🏻 Facebook page
🐱‍💻 GitHub
👲🏻 Twitter
👴🏻 LinkedIn
🔉 Podcast

Top comments (1)

Collapse
 
n3wt0n profile image
Davide 'CoderDave' Benvegnù

Question of the day ✨: What do you use or plan to use your PATs for?