git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Git Bug Report: git credential 'url' parsing clear other fields

From
TDThomas Desveaux <desveaux.thomas@gmail.com>
Date
Apr 26, 2024, 19:27 UTC
Message-ID
<CACPMLSqTA6pY3hiawhTAmhfvWME8NRUehauy6g-oUaHjordWqA@mail.gmail.com>
Hi,

I encountered what seems to be a small bug in git credential parsing. Just want to confirm it's not expected behavior. I'm willing to work on a patch.

First time submitting a bug to git (and a potential patch), so let me know if I do anything wrong!

What did you do before the bug happened? (Steps to reproduce your issue)
Run git credential approve with the 'url' field of the form NOT as first entry.

example: git -c credential.helper= -c "credential.helper=store --file=.git-credentials" credential approve

input: ``` username=user password=s3cret url=https://example.com/repository.git ```

This next input works as intended. input: ``` url=https://example.com/repository.git username=user password=s3cret ```

This was reproduced on both master and next branches.
What did you expect to happen? (Expected behavior)

Credentials should be saved with `username` and `password` provided. `url` parsing should not clear the `credential` struct.

What happened instead? (Actual behavior)

`username` and `password` are correctly parsed and stored in the struct. `url` parsing then clear the fields.

Culprit would be this `credential_clear` in `credential_from_url_1`. On branch `next`, commit `2a3ae87e7f8e9585d7565a8b5d6a6c9c28d6d943`.

Thanks, Thomas Desveaux

Next: Jeff King
Message 1 of 2 in “Git Bug Report: git credential 'url' parsing clear other fields”
  1. Thomas DesveauxApr 26, 2024
  2. Jeff KingApr 29, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.