Chapter 2. Git & GitHub Initial Settings

Generating PAT (Personal Access Token)

Generating PAT (Personal Access Token)
Tag:

To establish HTTPS connection, you’ll need PAT (Personal Access Token). There are two types of PAT: Tokens (classic) and Fine-grained tokens (beta version as of 2023 September). When you use the Fine-grained tokens, you can add more detail settings. For the beginner practice purposes, we'll explain how to set up PAT using the classic one.

1. Log into GitHub and go to user settings

Go to the GitHub website (GitHub ), click on your icon, and press the Settings button.

Generating-PAT-Personal-Access-Token

2. Move to Developer Settings page

Go to the bottom of the left sidebar and select Developer settings.

Generating-PAT-Personal-Access-Token

3. Generate a new token

Select Tokens (classic) under Personal access tokens and press the Generate new token button. Select Generate new token (classic).

Generating-PAT-Personal-Access-Token

Add Note (describe what the token is for) and set Expiration. After the token expires, you need to generate another token.

In the Select scopes section, you need to check repo to get access to your Private Remote Repositories. You can add other scopes later when required.

Generating-PAT-Personal-Access-Token

Press the Generate token button.

Generating-PAT-Personal-Access-Token

When a new token is successfully generated, you’ll see your PAT. Make sure you’ll copy it and save it somewhere as it won't be shown again.

Generating-PAT-Personal-Access-Token

When PAT is used?

PAT is used when you establish an HTTPS connection to your Remote Repository. To establish HTTPS connections going forward, go to your repository on GitHub and press the Code button. Make sure to select the HTTPS tab to get the URL for HTTPS. (the URL for SSH is different). This URL is used when you run the clone, push, or pull command.

Generating-PAT-Personal-Access-Token

When you clone, push, or pull, you’ll be asked for your username and password. You need to use PAT instead of the GitHub password. Previously, it was a GitHub password, however, GitHub changed the rule to strengthen the security level. How to establish an HTTPS connection will be explained in the later chapters along with the key git commands: git clone, git remote, git push, and git pull.

To establish HTTPS connection, you’ll need PAT (Personal Access Token). There are two types of PAT: Tokens (classic) and Fine-grained tokens (beta version as of 2023 September). When you use the Fine-grained tokens, you can add more detail settings. For the beginner practice purposes, we'll explain how to set up PAT using the classic one.

1. Log into GitHub and go to user settings

Go to the GitHub website (GitHub ), click on your icon, and press the Settings button.

Generating-PAT-Personal-Access-Token

2. Move to Developer Settings page

Go to the bottom of the left sidebar and select Developer settings.

Generating-PAT-Personal-Access-Token

3. Generate a new token

Select Tokens (classic) under Personal access tokens and press the Generate new token button. Select Generate new token (classic).

Generating-PAT-Personal-Access-Token

Add Note (describe what the token is for) and set Expiration. After the token expires, you need to generate another token.

In the Select scopes section, you need to check repo to get access to your Private Remote Repositories. You can add other scopes later when required.

Generating-PAT-Personal-Access-Token

Press the Generate token button.

Generating-PAT-Personal-Access-Token

When a new token is successfully generated, you’ll see your PAT. Make sure you’ll copy it and save it somewhere as it won't be shown again.

Generating-PAT-Personal-Access-Token

When PAT is used?

PAT is used when you establish an HTTPS connection to your Remote Repository. To establish HTTPS connections going forward, go to your repository on GitHub and press the Code button. Make sure to select the HTTPS tab to get the URL for HTTPS. (the URL for SSH is different). This URL is used when you run the clone, push, or pull command.

Generating-PAT-Personal-Access-Token

When you clone, push, or pull, you’ll be asked for your username and password. You need to use PAT instead of the GitHub password. Previously, it was a GitHub password, however, GitHub changed the rule to strengthen the security level. How to establish an HTTPS connection will be explained in the later chapters along with the key git commands: git clone, git remote, git push, and git pull.

Tag: