DEV Community

khaled-17
khaled-17

Posted on • Updated on

Personal Access Token from GitHub

why Personal Access Token from GitHub


To use a Personal Access Token from GitHub as a password instead of your account password when using HTTPS, you can follow the following steps:

Create a Personal Access Token:
Log in to your GitHub account.

Go to your GitHub account settings.

Navigate to the "Developer settings" section from the left sidebar.

Select "Personal access tokens" from the options.

Click on "Generate token" to create a new Personal Access Token.

Choose the permissions you need for your project (such as read and write access to repositories), then click "Generate token."

A page with your Personal Access Token will appear. Copy this token. This will be your only chance to see the full token, so make sure to save it in a secure place.

Use the Personal Access Token when using Git:
When cloning a project from GitHub using the git clone command, include the Personal Access Token in the URL.

Replace PERSONAL-ACCESS-TOKEN with the Personal Access Token you created in the previous step.

Use the following command:

 git clone https://PERSONAL-ACCESS-TOKEN@github.com/mygitacount/myrepo.git

Enter fullscreen mode Exit fullscreen mode

GitHub will prompt you for the username as usual, but in the password field, use the Personal Access Token you created.

This way, you can use the Personal Access Token for authentication when interacting with GitHub projects over HTTPS instead of using your account password. This enhances security and maintains the confidentiality of your account information.

Top comments (0)