How to Create Personal Access Token in GitHub?

how to create personal access token in github


If you try entering password, for any git cli commands like clone, pull or push to perform some actions on your repository that is hosted on github.com. It wont work anymore. Because, GitHub removed the password authentication. Instead, We have to use personal access token. That should be generated on your github account.

github password authentication failed

This post will help you with how to create personal access token in GitHub.


Also You can watch this tutorial demo video on our YouTube Channel.

"How to Create Personal Access Token in GitHub"

How to Create Personal Access Token in GitHub?


First login to your github account. At the right top corner, click on your profile and go to settings.

github profile settings


Here you will find lot of options related to your profile, login, security and other options. Scroll down and click on developer settings.

github developer settings generate access token



Then we could see few options like Github apps, O auth Apps, and Personal access token. Here click on Personal access token.

github personal access tokens

Just read this information if you want. This is the page where we could see list of tokens available on this account. This is the first time, we are going to create a token, so it wont list any tokens. Lets create new one now. just click on this button, generate new token.

generate new access token in github

This is the main form where we have to give information like, name for this token, Validity of token expiration and what kind of access we have to give for this token. Let me put Some meaningful name for this token.

github new personal access token expiration scopes


Then expiration.  Expiration is nothing but a validity for the token. If the validation is expired, this token cannot be used.  You can give 7 days, 30 days, 60 days, 90 days, custom date and even you have no expiration.

It is always good from security prespective to set a expiration for any tokens. I just give no expiration, since it is just a demo. No expiration means, this token wont expire.

Then finally, scopes. On Scopes , we can customized the access like what kind of access we need to give for a token whether this token need pull access or push or clone or commit.

Select as per your requirement. Once all these scopes are defined. Click on generate token.

github generate token


That’s all, we have got a new token.

Once you have created token, you would be able to modify only note and scopes. You cannot modify token and  expiration, keep it in mind.

If you want to change expiration, we have to regenerate token with new expiration.

github personal access token regenerate


This token has to be stored in a secured place. Also you wont see this page again. Because if we lost this token, it cannot be recovered. then we have to regenerate new token.

So lets test this token whether it works or not. Just copy this token and enter it in the password prompt.

Let me clone my remote repo again.

git with access token


I am able to clone my remote repo with personal access token instead of password.

Can we have multiple personal access token in a single github account?

Yes, Single account can have multiple personal access token to have different expiration and different scopes.

That’s it. Hope you have got an idea, how to create personal access token in github?

Also Request you to go through the below recommended tutorial, if you are interested in learning.


Keep practicing and have fun. Leave your comments if any.

Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.

Post a Comment

0 Comments