Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
maxLevel1

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 barImage Modified

In the left sidebar, click  Developer settings.

In the left sidebar, click Personal access tokens.

Personal access tokensImage Modified

Click Generate new token.

Generate new token buttonImage Modified

Give your token a descriptive name.

Token description fieldImage Modified

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

Token expiration fieldImage Modified

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

Selecting token scopesImage Modified

Click Generate token.

Generate token buttonImage Modified

Warning

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:

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


Info

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