Web lists-archives.com

Re: Fwd: Git credentials not working




Thanks for your reply. I have activated GIT_TRACE_CURL=1 and I can see that the request is failing 401.

I can't see which token is used and using what header ?

The log say:

17:50:26.414654 http.c:657              => Send header: Authorization: Basic <redacted>

I have retested the token locally and it work when used in the url or using `Private-Token: <token>` as stated in the Gitlab documentation https://docs.gitlab.com/ee/api/README.html#personal-access-tokens

Peff, what would be the appropriate way to input my git credential in a 100% success way in a CI?

Is this good:

git credential approve <<EOF
protocol=https
host=example.com
username=bob
password=secr3t
OEF

?

I would use the custom helper after I can understand how to properly use the git credential store in a CI environment. The fact that I am using a generated file is simply because this is what the documentation told me to do. I did not found anywhere in the doc how I should create that file in a non tty terminal.

Thanks again for your help.

On 10/4/18 12:11 AM, Jeff King wrote:
On Wed, Oct 03, 2018 at 09:06:38PM +0700, Dimitri Kopriwa wrote:

18:25:52.940307 git.c:659               trace: exec: git-credential-store erase
18:25:52.940365 run-command.c:637       trace: run_command: git-credential-store erase
remote: HTTP Basic: Access denied
fatal: Authentication failed for
'https://git.example.com/example/some-project.git/'
[...]

Can you please help me found why is git credential-store erase called ?
This is expected. We tried to use a credential that was rejected by the
server, so we told all of the helpers it was invalid. You can try
running GIT_TRACE_CURL=1 to see the HTTP conversation. There will be an
HTTP 401 with the authentication failure, though it may not tell you
anything more useful than that.

git-credential-store is meant to be used interactively, to insert and
erase credentials as they're grabbed from the terminal.

It sounds more like you want to just have a stored credential that you
try to use. You could do that with a custom helper. E.g., something like
this in your ~/.gitconfig:

   [credential "https://example.com";]
   helper = "!f() { test $1 = get && echo password=$(cat /path/with/password); }; f"

-Peff