Software Testing | How to generate a personal token on GitHub?

Insert image description here

Introduction

Generating a Personal Access Token on GitHub is a secure way to make API requests, access private repositories, or perform other operations that require authentication. This article details how to generate a personal access token on GitHub.

Step 1: Log in to your GitHub account

If you haven't registered a GitHub account yet, you need to register a GitHub account first, and we won't go into details here. If we already have an account, just log in to our account.

Step 2: Go to personal settings

  1. Click on the avatar in the upper right corner of the page and select "Settings", as shown below:

Insert image description here
2. In the left navigation bar, click "Developer settings" at the bottom, as shown below.

Insert image description here

Step 3: Visit the Personal Access Tokens page

  1. On the "Developer settings" page, select "Personal access tokens" as shown below, and select tokens.

Insert image description here

Step 4: Generate new token

  1. On the "Personal access tokens" page, click the "Generate token" button and choose to generate a new token.

Insert image description here

Step 5: Configure token

  1. In the "Note" (token tag) field, enter a descriptive name to later identify what the token is for.
  2. In the "Expiration" section, select an expiration time for the token. You can choose to have the token never expire, or expire after a few days, weeks, or months.
  3. In Select scopes, select the permissions for this token. Depending on your needs, you can choose different permissions, such as reading warehouse, writing warehouse, accessing deployment keys, etc.

Insert image description here

Step 6: Generate Token

  1. Click the "Generate token" button at the bottom of the page.

Insert image description here

Step 7: Copy the token

  1. Once the token is generated, it will only be displayed once. Be sure to copy the generated token immediately and save it in a safe place. We will not be able to see the contents of this token again.

Step 8: Use a personal access token

  1. Paste the generated personal access token into the application or tool that requires authentication. For example, when using Git from the command line to clone a private repository, you can use the token as an alternative to the username and leave the password field blank. As follows:
git clone https://github.com/yourusername/yourrepository.git
Username: yourtoken
Password: (leave this field blank)

Note: Personal access tokens are very sensitive, do not share them with others and revoke or delete them immediately when no longer needed.

Step 9: Revoke Token

A personal access token can be revoked at any time if it is deemed that it may no longer be secure or required. In the "Personal access tokens" page, find the corresponding token and click the "Revoke" button, as shown below.

Insert image description here

Summarize

In summary, generating a GitHub personal access token is a secure and common way to make API requests, access private repositories, and perform other operations that require authentication. Make sure to keep the token safe and only use it with trusted applications and tools. I hope this article helps you understand how to generate and use GitHub personal access tokens.

Guess you like

Origin blog.csdn.net/Tester_muller/article/details/132763600