* Add back changes from prior to purge * Manually fix some invalid Liquid * Updoot render-content * Improve test messages to show correct output * Run el scripto * Pass the remaining test
3.9 KiB
title, intro, redirect_from, versions
| title | intro | redirect_from | versions | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Creating a personal access token | You should create a personal access token to use in place of a password with the command line or with the API. |
|
|
Personal access tokens (PATs) are an alternative to using passwords for authentication to {% data variables.product.product_name %} when using the GitHub API or the command line.
{% if currentVersion == "free-pro-team@latest" %}If you want to use a PAT to access resources owned by an organization that uses SAML SSO, you must authorize the PAT. For more information, see "About authentication with SAML single sign-on" and "Authorizing a personal access token for use with SAML single sign-on."{% endif %}
{% if currentVersion == "free-pro-team@latest" %}{% data reusables.user_settings.removes-personal-access-tokens %}{% endif %}
Creating a token
{% if currentVersion == "free-pro-team@latest" %}1. Verify your email address, if it hasn't been verified yet.{% endif %}
{% data reusables.user_settings.access_settings %}
{% data reusables.user_settings.developer_settings %}
{% data reusables.user_settings.personal_access_tokens %}
4. Click Generate new token.
5. Give your token a descriptive name.
6. 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.
7. Click Generate token.
8. Click {% octicon "clippy" aria-label="The copy to clipboard icon" %} to copy the token to your clipboard. For security reasons, after you navigate off the page, you will not be able to see the token again.{% if currentVersion == "free-pro-team@latest" %}
{% else %}
{% endif %}
{% warning %}
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.
{% endwarning %} {% if currentVersion == "free-pro-team@latest" %}9. To use your token to authenticate to an organization that uses SAML SSO, authorize the token for use with a SAML single-sign-on organization.{% endif %}
Using a token on the command line
{% data reusables.command_line.providing-token-as-password %}
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.
If you are not prompted for your username and password, your credentials may be cached on your computer. You can update your credentials in the Keychain to replace your old password with the token.