0

In the question Why am I suddenly not having push permission? I was advised to use this command to store my credential:

printf "host=github.com\nprotocol=https\nusername=ooker777\npassword=ghp_yourToken" | git credential-manager-core store

I was explained that the command doesn't accept arguments, so it must be piped like that. Why is it so? Why not something like this?

git credential-manager-core store password myToken

1 Answer 1

1

The internal interface for storing and retrieving credentials from system-specific helpers described by "git credential" refers to credential.h.

The design presented in that file confirms the use of pipes to get arguments:

+-----------------------+
| Git code (C)          |--- to server requiring --->
|                       |        authentication
|.......................|
| C credential API      |--- prompt ---> User
+-----------------------+
^      |
| pipe |
|      v
+-----------------------+
| Git credential helper |
+-----------------------+

The Git code (typically a remote-helper) will call the C API to obtain credential data like a login/password pair (credential_fill).
The API will itself call a remote helper (e.g. "git credential-cache" or "git credential-store") that may retrieve credential data from a store.
If the credential helper cannot find the information, the C API will prompt the user. Then, the caller of the API takes care of contacting the server, and does the actual authentication.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.