How To Create Personal Access Token In GitHub

How To Create Personal Access Token In GitHub

How To Create Personal Access Token In GitHub

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

A Personal Access Token (PAT) can be used as an alternative of password to authenticate with GitHub when you’re performing a Git operation or API call with GitHub. In today’s blog post, we will discuss how to create a personal access token in GitHub.

The scope of the personal access token is your entire GitHub account or the entire GitHub organization of you are using GitHub organization feature. When you create a personal access token, you need to define the access level and expiration date for your access token. You can create multiple personal access token in your GitHub account.

Also GitHub removed authentication using password, hence if you are using https endpoint to perform git operation on GitHub, you will get an “fatal: Authentication failed for” error with a message “Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.” You can use personal access token created in this blog to fix this error (step 6).

How To Create Personal Access Token In GitHub

Prerequisites:

One active GitHub account, create one if you don’t have.

Step 1: Login to your GitHub account and click “Settings” located under your “Profile”.

How To Create Personal Access Token In GitHub

Step 2: Scroll down on the setting page and click “Developer settings”

How To Create Personal Access Token In GitHub

Step 3: In “Developer settings” click on “Personal access tokens”.

How To Create Personal Access Token In GitHub

Step 4: Click “Generate new token” to generate a new Personal Access Token.

How To Create Personal Access Token In GitHub

You may be requested to authenticate again, provide your password and click “Confirm password”

How To Create Personal Access Token In GitHub

Next, we need to provide the Personal Access Token configuration like access level and expiration date.

Step 5: Configure your Personal Access Token.

Provide a note and expiration date and select the level of access your want to get using this API.

How To Create Personal Access Token In GitHub

Since I will cover all the GitLab features in this blog series, I am giving full access to this token. Once you have selected your access levels, click “Generate token” to create a new token.

How To Create Personal Access Token In GitHub

We have successfully generated a new Personal Access Token for GitHub. Copy the token and store it in a safe place.

How To Create Personal Access Token In GitHub

Next, we are going to test if the access token is working.

Step 6: Test your personal access token.

Hope you have enjoyed this article. To know more about GitHub, please refer below official documentation

https://docs.github.com/en

Leave a Reply

Close Menu