Category Archives: GitHub

Setting up GitHub’s Personal Access Token (PAT)

When we are using multiple GitHub accounts on the same machine, they can be easily mixed up and cause errors. One solution for that is to incorporate Personal Access Token (PAT) for our repos.

First of all login to your GitHub account and select ‘Settings’ option from under your avatar:

From the left menu’s bottom side search for ‘Developer settings’:

Select ‘Personal access tokens’ option:

Click on the button ‘Generate new token’:

You might be forced to input your password and/or your token.

Input a note for the PAT, give an Expiration and select scopes:

For basic source code usage, ‘repo‘ category is enough.

From the bottom click on ‘Generate token’. The page will be redirected back to the list but on the top you will see the newly created token:

The token shown on the picture is not a real one 🙂

Now, when you are setting up your GitHub repo’s remote url use the following template:

https://GitHubUserName:PAT@github.com/RepoOwnerGithubUserName/RepoName.git

Example given:

https://Szerpentin:ghp_mynewlycreatedpat@github.com/Szerpentin/BlogDavid_PythonBasicTesting.git

SourceTree

If you are using SourceTree you can set it up under the repo’s ‘Settings’ option or clone the repo already with the PAT included url:

Happy coding!