Creating a token

Log in to github.com.

In the upper-right corner of any page, click your profile photo, then click Settings.

Settings icon in the user bar

In the left sidebar, click  Developer settings.

In the left sidebar, click Personal access tokens.

Personal access tokens

Click Generate new token.

Generate new token button

Give your token a descriptive name.

Token description field

To give your token an expiration, select the Expiration drop-down menu, then click a default or use the calendar picker.

Token expiration field

Select the scopes, or permissions, you'd like to grant this token. To use your token to access repositories from the command line, select repo only.

Selecting token scopes

Click Generate token.

Generate token button

Treat your tokens like passwords and keep them secret. When working with the API, use tokens as environment variables instead of hardcoding them into your programs.


Using a token on the command line

Once you have a token, you can enter it instead of your password when performing Git operations over HTTPS.

For example, on the command line you would enter the following:

$ git clone https://github.com/username/repo.git
Username: your_username
Password: your_token

Personal access tokens can only be used for HTTPS Git operations. If your repository uses an SSH remote URL, you will need to switch the remote from SSH to HTTPS.


The scientific work is published for the realization of the international project co-financed by Polish Ministry of Science and Higher Education in 2019 from financial resources of the program entitled "PMW"; Agreement No. 5040/H2020/Euratom/2019/2

This work has been carried out within the framework of the EUROfusion Consortium and has received funding from the Euratom research and training programme 2014–2020 under grant agreement No 633053. The views and opinions expressed herein do not necessarily reflect those of the European Commission or ITER

  • No labels