Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use Personal access token to clone, pull, and push a repo? [duplicate]

Tags:

git

github

Today GitHub surprise me with a new way to push, clone, or pull a repo

when I'm trying to push my project I get this error message:

remote: Password authentication is temporarily disabled as part of a brownout. Please use a personal access token instead.
remote: Please see https://github.blog/2020-07-30-token-authentication-requirements-for-api-and-git-operations/ for more information.
fatal: unable to access 'https://github.com/barimehdi77/Philosophers.git/': The requested URL returned error: 403

after multiple searches I fined that GitHub adds a new security update named Personal access tokens but who can I use it?

like image 977
DarkSide77 Avatar asked Sep 03 '25 09:09

DarkSide77


2 Answers

You have to use SSH keys. Create one for each computer and register them all to the repo that you need to access. Doing this allows you to remove access computer by computer.

Once you have the SSH keys configured in Github, you can read this article to setup the Personal Access Tokens.

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

UPDATE It tells you how to change to the token in the documentation

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 <--- HTTPS, not SSH
Username: your_username
Password: your_token <-------- THE TOKEN, not your 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.

Instead of manually entering your PAT for every HTTPS Git operation, you can cache your PAT with a Git client. Git will temporarily store your credentials in memory until an expiry interval has passed. You can also store the token in a plain text file that Git can read before every request. For more information, see "Caching your GitHub credentials in Git."

Also found a good video walkthrough that may help clear up a few things.

https://www.youtube.com/watch?v=kHkQnuYzwoo

like image 123
Adrian J. Moreno Avatar answered Sep 05 '25 01:09

Adrian J. Moreno


The previous password will not work. you have to use a token as a password.

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

You can create your token following these steps:

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

like image 30
MD JULHAS HOSSAIN Avatar answered Sep 05 '25 01:09

MD JULHAS HOSSAIN