Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When I try to pull or push in GitHub, I am getting an error message: "Please use a personal access token instead."

I am using the version control as GitHub through SourceTree, but it is getting failed from 13th August, the below is the error I am getting from GitHub.

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.

Anybody know what was the problem, or how can I use the personal access token?

like image 895
Wide Angle Technology Avatar asked Aug 14 '21 06:08

Wide Angle Technology


People also ask

What is personal access token in GitHub?

Personal access tokens (PATs) are an alternative to using passwords for authentication to GitHub Enterprise Server when using the GitHub API or the command line. A token with no assigned scopes can only access public information. To use your token to access repositories from the command line, select repo .

How to use GitHub personal access token instead of GitHub password?

To solve this problem all we need to do is create a GitHub personal access token and use it instead of our GitHub password and a two-factor authentication code. Now, step by step guide. Creating a GitHub personal access token. In the upper-right corner of any page, click your profile photo, then click Settings.

How do I pull changes in Git using a personal access token?

If you are using PhpStorm, go to menu Git => pull and select authentication via Personal Access Token. Enter your PAT it will allow you to pull/push the changes. Be sure to save the token on some local file or in some cloud.Upvoted. Given that the OP states they already created a token two weeks ago, this doesn't address the actual problem.

Do you need a password to pull a repository on GitHub?

However, it also prompts you to enter your GitHub credentials every time you pull or push a repository. When Git prompts you for your password, enter your personal access token (PAT) instead. Password-based authentication for Git has been removed, and using a PAT is more secure.

Do I have to enter my GitHub credentials every time I pull?

However, it also prompts you to enter your GitHub credentials every time you pull or push a repository. When Git prompts you for your password, enter your personal access token (PAT) instead. Password-based authentication for Git has been removed, and using a PAT is more secure. For more information, see " Creating a personal access token ."


Video Answer


5 Answers

Since the OP is using SourceTree, do the following:

  1. Generate your Personal access tokens in Github account setting.
  2. Double click a repository in SourceTree, click Setting icon in the top right of the popup window.
  3. Click Remotes in the menu tab. You will see the remote URL of this repository, which should be like this https://github.com/username/repo.git.
  4. Click Edit and change it to https://<your_token>@github.com/username/repo.git.

DONE.

like image 136
Sam Su Avatar answered Oct 22 '22 01:10

Sam Su


Step 1: Generate token : https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token

Step 2: Open .git > config file and replace [remote "origin"] URL like this

https://<username>:<githubtoken>@github.com/<username>/<repositoryname>.git
like image 41
Parth kharecha Avatar answered Oct 21 '22 23:10

Parth kharecha


Faced the same issue and resolved it in this way:

Open sourcetree, in the right, click Settings (Repository settings) ->Remotes -> Select Origin and Edit:

Set URL/Path in the following format: https://<your_personal_access_token_from_github>@<git_url>.git

The other way to solve this is from git config file. For this, in your .git folder open open config file and replace [remote "origin"] URL like this

[remote "origin"]
    url = https://<your_personal_access_token_from_github>@<git_url>.git
    fetch = +refs/heads/*:refs/remotes/origin/*
like image 3
Ankit Uniyal Avatar answered Oct 22 '22 01:10

Ankit Uniyal


Beginning August 13, 2021, Github no longer accepts account passwords when authenticating Git operations and will require the use of token-based authentication.

Guide Line Youtube Video: https://youtu.be/eZrOd5qM5WM Steps to create Personal Access Token: http://mtahirmunir.com/github-support-for-password-authentication-was-removed/

like image 1
tahir Avatar answered Oct 22 '22 01:10

tahir


First of all you need to create a Personal access tokens by going from your Github account -> Settings -> <> Developer settings -> Personal access tokens -> Generate new token. You specify a name for the token, expiration date, as well as what possibilities it may have. After clicking "Generate token", make sure you keep the code that will appear because you will use it as a login code to log in to Sourcetree with a Github account instead of your original github password.

Now, you have to re-enter your details to login, using as password the token you created. To do this, go to C:\Users\{your_user_folder}\AppData\Local\Atlassian\SourceTree and delete the passwd file, so force Sourcetree asks you to re-enter credentials.
Open SourceTree normally, and when it asks you to enter credentials, as password enter the token as mentioned above.

like image 1
Minas-Theodoros Charakopoulos Avatar answered Oct 22 '22 01:10

Minas-Theodoros Charakopoulos