After creating a token, how do you unset the existing password and use the token instead?
I tried running osxkeychain command git config --global credential.helper osxkeychain
but it doesn't change anything. I also tried unsetting the user password with git config --global --unset user.password
, and I tried opening Keychain Access application and delete GitHub entries, but neither worked.
Updating an existing Access Token If your existing token has expired, or been revoked, or you are on a new machine and do not have access to the existing token then you can regerate a new one in the Github console Settings -> Developer settings -> Personal access tokens .
Updating your credentials via Keychain AccessType Keychain access then press the Enter key to launch the app. In Keychain Access, search for github.com. Find the "internet password" entry for github.com . Edit or delete the entry accordingly.
Making a New Personal Access TokenHead over to your personal account settings to generate a new token. Scroll down to “Developer Settings.” Select “Personal Access Tokens,” and generate a new one: You'll need to verify your actual account password. Give the token a name, and select an expiration date.
However, regardless of the case you are facing, I will explain how to update your personal access token using the terminal. Go to the personal access token of your GitHub account. Open menu from the top right corner next to your profile picture. Click on Settings. Click on Developer Settings. Click on Personal access tokens.
You can tell Git you want to store credentials in the osxkeychain by running the following:- Now issue a command to interract with Github which requires authentication, eg. git clone or git pull. When you are prompted to supply your Password for ' https://[email protected] ': you enter your access token instead.
Use the mac search for "keychain" and open Keychain Access.app Search for GitHub. You may see two options: an application password and an internet password Open the application password. You may check the box for "Show password and likely see that this still uses your password rather than the token.
For more information, see " Creating a personal access token ." Click on the Spotlight icon (magnifying glass) on the right side of the menu bar. Type Keychain access then press the Enter key to launch the app. In Keychain Access, search for github.com.
Step 1
Copy this into your terminal to unset existing GitHub login credentials:
git config --global --unset credential.helper
git credential-osxkeychain erase
host=github.com
protocol=https
Step 2
Open a new terminal window, and set the name and email for commits:
git config --global user.name "Your Name"
git config --global user.email [email protected]
Step 3
Run a git push
or git clone
a private repository so GitHub prompts you to enter your username and password.
For the username, simply enter your email.
For the password paste in your token (i.e. copy the token from GitHub website where you created it and paste it in).
The below command worked for me on mac as mentioned in https://gist.github.com/jonjack/bf295d4170edeb00e96fb158f9b1ba3c.
security delete-internet-password -l github.com
After running this command in terminal, run a git clone command and it will ask you the username and password. On password please provide your access token which you created from the github web portal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With