0% found this document useful (0 votes)
67 views4 pages

2 - How To Create A Personal Access Token in GitHub

The document discusses resolving an authentication issue when pushing to GitHub from the command line using a password. It provides steps to create a personal access token to use instead of a password for authentication. The token should be used in place of the password when pushing or cloning a repository from the command line over HTTPS.

Uploaded by

Kashif Kamal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views4 pages

2 - How To Create A Personal Access Token in GitHub

The document discusses resolving an authentication issue when pushing to GitHub from the command line using a password. It provides steps to create a personal access token to use instead of a password for authentication. The token should be used in place of the password when pushing or cloning a repository from the command line over HTTPS.

Uploaded by

Kashif Kamal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Problem

[engr_kkamal@myinstance-1 khi-dir]$ git push -u origin master


Username for 'https://github.com': kkamal123
Password for 'https://kkamal123@github.com': ******
remote: Support for password authentication was removed on August 13, 2021. Please use a
personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-
operations/ for more information.
fatal: Authentication failed for 'https://github.com/kkamal123/TestGit.git/'

Resolution

https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/
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.

Creating a token
1. Verify your email address, if it hasn't been verified yet.
2. In the upper-right corner of any page, click your profile photo, then

click Settings.

3. In the left sidebar, click Developer settings.


4. In the left sidebar, click Personal access tokens.
5. Click Generate new token.

6. Give your token a descriptive name.

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

8. 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.
Click on all checked box
9. Click Generate token.

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.

10. 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.

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

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.
[engr_kkamal@myinstance-1 khi-dir]$ git push -u origin master
Username for 'https://github.com': kkamal123
Password for 'https://kkamal123@github.com': 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

Enumerating objects: 3, done.


Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 254 bytes | 254.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/kkamal123/TestGit.git
* [new branch] master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy