Guidebook

From the Guidebook library

Create a fine-grained personal access token

7 steps · opens github.com · Beta

Beta. This guide was written from the product's documentation and hasn't been walked on the real website yet, so a step may not match what you see. It will show a “tested” date once it has been checked.

To follow this guide on the real website, you need the Guidebook browser extension. It points at each thing to click and waits for you to do it.

Add Guidebook to Chrome

It's free. After it's added, come back to this page and click Start.

Send to my computer

Guidebook runs in Chrome on a computer. Send yourself this page and open it there.

You can also read the steps below.

The steps

  1. What you'll do

    A token is like a password for a tool or script. A fine-grained one can be limited to certain projects and actions, so it's safer. You need to be signed in to GitHub. Click Next to begin.

  2. Name the token

    Click in this box and type a name that says what the token is for, like Deploy script.

  3. Set when it expires

    Choose how long the token should last. Shorter is safer, so 30 days is a good start. Then click Next.

  4. Choose what it can reach

    Choose Only select repositories, then pick the projects the token may use. This keeps it from touching anything else.

  5. Choose what it can do

    Click Add permissions and tick only what the tool needs, such as Contents to read your code. Click Next when you've chosen.

  6. Generate it

    Click Generate token. A dialog may ask you to confirm. Check what it lists, then confirm.

  7. Copy it now

    GitHub shows the token once, and never again. Copy it now and keep it somewhere safe, like a password manager. Never share it or put it in a project's files. If you lose it, make a new one.

Use this guide another way

This is the guide itself. Paste it into Guidebook's Add a guide box, or keep it with your own guides.

---
id: github-fine-grained-token
title: Create a fine-grained personal access token
start: https://github.com/settings/personal-access-tokens/new
---

Make a token that lets a tool act on only the repositories you choose, with only the permissions you give it.

## What you'll do {#welcome}
show: card
advance_on: manual
novice: A token is like a password for a tool or script. A fine-grained one can be limited to certain projects and actions, so it's safer. You need to be signed in to GitHub. Click **Next** to begin.
expert: Create a fine-grained PAT scoped to specific repositories and permissions. Sign in first.

## Name the token {#name}
anchor: { role: textbox, name: "Token name" }
show: spotlight
advance_on: input
novice: Click in this box and type a name that says what the token is for, like **Deploy script**.
expert: Enter a descriptive token name.

## Set when it expires {#expiry}
anchor: { role: button, name: "Expiration" }
show: tooltip
advance_on: manual
novice: Choose how long the token should last. Shorter is safer, so 30 days is a good start. Then click **Next**.
expert: Set the shortest expiry that fits the job.

## Choose what it can reach {#repos}
anchor: { role: radio, name: "Only select repositories" }
show: spotlight
advance_on: click
novice: Choose **Only select repositories**, then pick the projects the token may use. This keeps it from touching anything else.
expert: Choose **Only select repositories** and pick them. Avoid all repositories.

## Choose what it can do {#permissions}
anchor: { role: button, name: "Add permissions" }
show: spotlight
advance_on: manual
novice: Click **Add permissions** and tick only what the tool needs, such as **Contents** to read your code. Click **Next** when you've chosen.
expert: Add only the repository permissions required, at read or write as needed.

## Generate it {#generate}
anchor: { role: button, name: "Generate token" }
show: spotlight
advance_on: click
novice: Click **Generate token**. A dialog may ask you to confirm. Check what it lists, then confirm.
expert: Click **Generate token** and confirm the summary.

## Copy it now {#copy}
show: card
novice: GitHub shows the token once, and never again. Copy it now and keep it somewhere safe, like a password manager. Never share it or put it in a project's files. If you lose it, make a new one.
expert: The token is shown once. Store it in a secrets manager, never in the repo.