in a 10+ people team we access the same ubuntu VM and we 'su' to the same user. On that user we make use of git-credential-cache feature to not type our personal password again and again.

As all password are stored using the socket owned by the same user, can a simple program retrieve all plaint text passwords? If yes, any pointers on how to demonstrate it?

If yes, we should definately change the way we cache passwords (a session token would be fine for us).

1 Answer 1


Yes, git-credential-cache has the built-in functionality to read the cache contents, you just need to run this command to obtain the stored credentials, including password in plain-text:

$ echo -ne 'username=<repo_user>\nprotocol=<repo_protocol>\nhost=<repo_host>\n' | git credential-cache get

For instance, if you are using https://[email protected] as your repository, you could extract stored credentials by doing this:

$ echo -ne 'username=git\nprotocol=https\nhost=github.com\n' | git credential-cache get

The "username" part in the query is only required if you have more than one user working on the same repository (which I guess is your situation).

  • 1
    This is exactly what I needed. Now I will have to look for alternative (more secure) solutions to avoid typing passwords every time.
    – Michael
    Oct 31, 2016 at 7:50
  • 1
    I found unexpected behavior when a custom socket path is set. For example, if you ran git config --global credential.helper cache --socket=/custom/path/to/file you have to set the same custom socket with credential-cache commands, as it won't be read from the global config. For example, echo url=https://github.com | git credential-cache --socket=/custom/path/to/file get and git credential-cache --socket=/custom/path/to/file exit were required to read and erase what was stored after a git pull. Jul 9, 2021 at 3:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .