17

August 13th, github no longer accepts password for git actions. So, to update the token, I would have to change the password field in the keychain (github keychain) to token as recommend. But, Unfortunately I couldn't find my keychain related to github.

enter image description here

Where can I find the keychain for github, and edit it so that git actions works ?!

Sai Krishnadas
  • 2,863
  • 9
  • 36
  • 69

6 Answers6

26

Have you tried to put your token as password for git action? When git asked for the password, just put your token as password.

If you have never logged in to GitHub yet, then you will not find GitHub in the keychain. Make sure when you generate token you checked all the scopes you need.

Ryan M
  • 18,333
  • 31
  • 67
  • 74
  • 4
    Please provide additional details in your answer. As it's currently written, it's hard to understand your solution. – Community Sep 07 '21 at 22:17
  • 1
    I also faced same problem. Earlier I didn't check any scope while generated the access token. Then created a new one after checking all the scopes. It worked. – Avik Chowdhury Oct 26 '21 at 07:34
  • The problem with doing that is that so many times, even when you only select the minimum number of scopes, GitHub will tell you "Some of the scopes you’ve selected are included in other scopes. Only the minimum set of necessary scopes has been saved" which leaves you wondering what functionality is missing. I'd really like to hear an explanation of how that works. – stoddart Aug 10 '23 at 10:36
2

Assuming git config credential.helper does return osxkeychain, not finding github.com in it means: the helper is ready to cache your new credentials.
A new git push should display a prompt where you would enter your GitHub user account name, and your PAT (Personal Access Token).

Check first nothing was cached with:

printf "protocol=https\nhost=github.com"| git-credential-osxkeychain get

If it was, you could remmove it with the erase command:

printf "protocol=https\nhost=github.com"| git-credential-osxkeychain erase
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Sorry to nitpick but that second command line snippet was a duplicate of your first. I suspect the `get` on the end should be `erase`. – Martin Packer Aug 23 '21 at 15:22
  • 1
    @MartinPacker Good nitpicking, thank you :) I have edited the answer accordingly. – VonC Aug 23 '21 at 15:34
  • 1
    @VonC Yes, `git config credential.helper` does return `osxkeychain` but entering `git push` show the error regarding aug 13th password change and asks to use token instead. Trying the first cmd line snippet to find cache, it returns `zsh: command not found: git-credential-osxkeychain`. – Sai Krishnadas Aug 24 '21 at 04:44
  • @SaiKrishnadas Check out https://stackoverflow.com/q/13661354/6309 – VonC Aug 24 '21 at 05:27
  • @VonC osxkeychain is returned but, fails to do git operations. Used to work when github used password for authentication – Sai Krishnadas Aug 24 '21 at 11:10
  • @SaiKrishnadas Does `git-credential-osxkeychain` works now? If not, can you search for that file/executable on your disk? – VonC Aug 24 '21 at 11:51
  • @VonC my bad! Actually `git config credential.helper` returns `osxkeychain`. I use git using terminal and not as an mac app – Sai Krishnadas Aug 24 '21 at 13:13
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/236352/discussion-between-vonc-and-sai-krishnadas). – VonC Aug 24 '21 at 13:14
2

Just open KeyChain Access, then create a new entry >Passwords> click on the notepad symbol on the top right> in the keychain item name enter the url > then enter the username of the repo > copy the token into the password section.

1

I had the same problem and i solved that by connecting my github account via fork. it will help you to solve this problem.

emre
  • 68
  • 5
1

First, you need to generate your PAT on GitHub.

Then go back to your terminal: run a git command, input your GitHub username and use your token in place of your password.

Florian Lalande
  • 494
  • 4
  • 13
-1

You can download github desktop - https://desktop.github.com/ You can signin with your github credentials and you can clone and push/pull your code.

vinay
  • 1
  • 2
    Thanks for contributing, but I don't think this answer really addresses the question, which is about a fairly specific macOS keychain problem. – Norman Gray Nov 17 '21 at 16:48