Re: Git credential helper store flushes randomly
- Date: Fri, 12 May 2017 04:20:58 -0400
- From: Jeff King <peff@xxxxxxxx>
- Subject: Re: Git credential helper store flushes randomly
On Fri, May 12, 2017 at 11:05:19AM +0300, Райцин Антон wrote:
> I have very strange git credentials store behavior on one of my servers.
> I Use Ubuntu 14.04 LTS and git 2.10.2. The server have multiple users with
> multiple projects, so they have got many different git credentials to
> different repositories.
> I set git config --global credential.helper store, but the credential record
> strings from file ~/.git-credentials for one specific user disappears
> randomly. Especially for one specific repository.
> I do not see any TTL for git credentials in credential.helper store on git
> documentation, so I can't even imagine, what could cause such strange
> Is this a known problem and is there any solution to fix this problem?
I've never heard of a bug like this, and the credential-store code
hasn't really changed in the 5+ years since it was introduced.
The only time it should remove an entry is when Git asks it to. And the
only time that happens is when Git sees the credential rejected by the
server (e.g., an HTTP 401 even after we fed the stored credential). I
don't know why that would happen unless there's some non-determinism on
Running with GIT_TRACE=/path/to/logfile in the environment would let you
know when Git invokes the helper with the "erase" argument. But the
credential data itself is sent over stdin, so it won't be logged. And if
this is something that happens occasionally and randomly, you might have
to log for quite a while.
Likewise, running with GIT_CURL_VERBOSE=1 might show what's going on,
but you'd have to actually catch the offending git command (in more
recent versions of curl there is GIT_TRACE_CURL, which you can point at
a specific logfile rather than just stderr). Do note if you try logging
with GIT_CURL_VERBOSE that it includes your password in the output, so
treat it appropriately.