credential.<url>.helper with partial url path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Suppose I need to use different credential.helper values for different 
repositories on the same HTTPS host.  Ideally I would like to be able to 
write this logic using a partial URL path prefix, for example in 
~/.gitconfig

[credential "https://example.com/prefix1/foo.git";]
         helper = !ZZZ
[credential "https://example.com/prefix1/";]
         helper = !YYY
[credential "https://example.com/";]
         useHttpPath = true
         helper = !XXX

For prefix1/foo.git (exact path match) this tries ZZZ first as desired:

$ git credential fill
protocol=https
host=example.com
path=prefix1/foo.git

ZZZ get: ZZZ: command not found
XXX get: XXX: command not found
Username for 'https://example.com/prefix1/foo.git': ^C

However, prefix1/bar.git does not try YYY:

$ git credential fill
protocol=https
host=example.com
path=prefix1/bar.git

XXX get: XXX: command not found
Username for 'https://example.com/prefix1/bar.git': ^C

even though (AFAICT) the general behavior of git-config seems to imply 
that it would do so:

$ git config --get-urlmatch credential https://example.com/prefix1/bar.git
credential.helper !YYY
credential.usehttppath true

Is this discrepancy intended?

The documentation in `man gitcredentials` 
(https://git-scm.com/docs/gitcredentials) points out quite explicitly 
that my patterns will not match foo.example.com nor plain http, but both 
of those rules are consistent with what git-config reports:

$ git config --get-urlmatch credential https://foo.example.com/
credential.helper osxkeychain
$ git config --get-urlmatch credential http://example.com/
credential.helper osxkeychain

If indeed the current behavior of git-credential is as intended, I think 
it would be helpful for that manpage to explicitly mention it (i.e. that 
you may specify a URL path component but that it must match exactly). 
Right now the only example given is one in which 'the "pattern" URL does 
not care about the path component at all.'

I'm testing against

$ git --version
git version 2.19.0

installed via homebrew on Mac OS X.

Thanks,
David

-- 
David Zych
Lead Network Service Engineer
University of Illinois Technology Services




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux