git credential-osxkeychain get hangs

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
1

1 Answer

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.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like