Github (Personal Access Token) authentication

아야루·2023년 11월 29일
0
post-thumbnail

If you see the following error trying to clone/do sth with a repo:

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for '..'

When searching for this error, you can see this statement:

From August 13, 2021, GitHub is no longer accepting account passwords when authenticating Git operations. You need to add a PAT (Personal Access Token) instead, and you can follow the below method to add a PAT on your system.

So let's see how we can add a Personal Access Token.
1) Go to 'Settings' tab in your personal GitHub account. (not repository)
2) Scroll to the bottom and click "Developer Settings".

3) Go to "Personal Access Tokens" -> "Tokens"

4) On the top-right corner, click "Generate new token" and you can choose classic version.

5) Fill out the form for new token, defining scope of actions user can do with this token.

6) Save the token (copy) because once the window is closed or refreshed, you will not be able to see it again. If you lose your token, just delete it and create a new one.

7) Now try to clone the repo again, and when prompted, type your github username and paste the token instead of typing your password.

Done!
More reference: stackoverflow
gh forum

Note:

remote: Repository not found.
fatal: repository 'https://github.com/....git/' not found

If you see this message, it means your account does not have collaborator permission to the repo you wanted to work with. Ask the owner of that repository to add you as a collaborator and try again.

Hope it helps.

profile
my new hack stack

0개의 댓글