Git Repository Cloning with Personal Access Token: A Step-by-Step Guide
What is a Personal Access Token (PAT)?
A Personal Access Token, often abbreviated as PAT, is a secure way to authenticate yourself when interacting with Git repositories hosted on platforms like GitHub, GitLab, or Bitbucket. Unlike traditional username and password authentication, PATs are more secure because they are temporary and can have restricted permissions. This means you can limit what actions a PAT can perform, reducing the risk of unauthorized access to your repositories.
Creating a Personal Access Token
- Log in to your GitHub account.
- Head over to settings → developer settings
4. Select “Tokens (classsic) under “personal access tokens”
5. Click the “Generate token” button.
Get Adil’s stories in your inbox
Join Medium for free to get updates from this writer.
6. Provide a token description and select the desired permissions for the token. Be cautious about the permissions you grant.
7. Click the “Generate token” button at the bottom of the page.
8. Now that you have your personal access token (PAT), go to the repo you would like to clone and use the HTTPS option.
8. Paste and run the command in your terminal, which should prompt you to enter username (your email for github) and password which is your PAT.
9. Entering that info should allow you to clone the repo and give you access.
10. Once you have cloned the repo, run this command to save your PAT on local machine and prevent having to enter them repeatedly.
git config --global credential.helper storeThank you for reading and if there are any mistakes or suggestions to make the workflow better please comment below.






