If I execute git credential-osxkeychain get, it just hangs when it should return information regarding what credentials are stored in the keychain. Is there a way to make this work?

I am using OS X 10.15.5

$ git credential-osxkeychain
usage: git credential-osxkeychain <get|store|erase>

$ git --version
git version 2.27.0
  • Are you sure that's what it should return? The individual git credential-foo helpers are normally for git's internal use only. – user1686 Jul 1 at 15:17

All of git credential-* helpers are meant to be used internally by git itself and follow a specific interface.

When the helper is run with the get subcommand, it waits for input on stdin and expects to read a series of "key=value" lines. For example, host=github.com. This is how git tells the helper which credentials are needed.

When you run a program directly in a terminal, its stdin is just connected to keyboard input. After the first Enter keypress, the tool is already running but waiting for keyboard input, exactly like tools such as cat or sed would.

After the second keypress, the program reads an empty line and treats it as an "end of input" indicator, i.e. that no more key=value lines will be entered. At this point it searches the keychain and finds whichever entry it thinks matches your "provided" filter.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.