GitHub Desktop personal access token

How to create Github personal access token or PAT

March 22, 2021

How to setup Github personal access token:

Github will stop supporting https with password starting from August, 13th 2021. Alternatively, Github is providing a new way to connect to your git repositories. It is called a personal access token or PAT. Creating a new PAT is easy and it is more easy to manage than ssh.

Most application supports PAT now. For example, on Android Studio or Github desktop, if you try to clone or push to an unknown account, it asks for PAT. Below image is on a Windows laptop while I am trying to push code to a new account:

GitHub Desktop personal access token

  1. Click on Personal access token on the left bar.

GitHub Desktop personal access token

  1. It will show you the list of tokens already generated. Click on Generate new token to create a new token. You can give a name for the token. Also, you can select from a list of permissions to give for this token.

GitHub Desktop personal access token

  1. Click on Generate token to generate the token. For security reasons, this token is shown only for one time. If you refresh the page, it will be removed.

How to use it on command line:

PAT works only with https. We can use it instead of password. For example, if we are cloning a repository on https, we can enter the username as the github username and PAT as the password.

Also, note that personal access token is deleted automatically if it is not used for more than one year.