Skip to main content

How to Create a Personal Access Token

This document explains how to create a Personal Access Token (PAT) on GitHub for Git Deployment with read-only access to the project repository.

This token is only used to pull source code, without permission to write or modify the repository.


When Is This Token Used?

  • Git Deployment (auto pull)
  • Private repository
  • Secure access (read-only)

Creation Steps

1. Open GitHub Settings

  1. Log in to GitHub
  2. Click your profile photo in the top right
  3. Select Settings

1


2. Go to Developer Settings

Navigate to:

SettingsDeveloper settingsPersonal access tokensFine-grained tokens

  • Developer Settings 2

  • Tokens 3

  • Fine-grained Tokens 4


3. Generate Token (Read-Only)

Click Generate new token, then set it up as follows:

  • Token name: for example raznar-git-deploy

  • Expiration: as needed

  • Repository access:

    • Only select repositories
    • Select the project repository
  • Permissions:

    • Contents → Read-only
    • Metadata → Read-only

⚠️ Do not enable any other permissions.

5

4. Generate & Save the Token

Click Generate token and copy the token.

6

IMPORTANT

The token only appears once. Store it safely.


Using the Token

Use the token when configuring the repository on the server.

Example repository URL:

https://<USERNAME>:<PERSONAL_ACCESS_TOKEN>@github.com/username/repository.git

Security Notes

  • Use a read-only token
  • Don't share the token, keep it safe
  • If it leaks, revoke it immediately