Why is Giit `credential.<URL>` with `useHttpPath` not treated correctly?

79 views Asked by At

I have the following in my global gitconfig

[credential "https://git.server.com"]
    useHttpPath = true

and a credential entry to the Git credential manager with

echo -n "protocol=https\nhost=git.server.com\npath=/repos/myrepo2.git\nusername=bla\npassword=mypass1\n" | git credential approve

echo -n "protocol=https\nhost=git.server.com\npath=/repos/myrepo2.git\nusername=bla\npassword=mypass2\n" | git credential approve

Because I want to use exacly this two credential for the URLs the git credential fill

echo -n "protocol=https\nhost=git.server.com\npath=/repos/myrepo1.git\nusername=bla\n" | git credential fill

echo -n "protocol=https\nhost=git.server.com\npath=/repos/myrepo2.git\nusername=bla\n" | git credential fill

works and returns password=mypass1 and mypass2. When I however use /repos in the config

[credential "https://git.server.com/repos"]
    useHttpPath = true

the useHttpPath is not picked up for

echo -n "protocol=https\nhost=git.server.com\npath=/repos/myrepo1.git\nusername=bla" | git credential fill

and therefore I get mypass2 as result.

Is this a Git bug? Documentation: https://git-scm.com/docs/git-credential#IOFMT

0

There are 0 answers