reuse http url password for p2phttp url when on same host

When remote.name.annexUrl is an annex+http(s) url, that uses the same
hostname as remote.name.url, which is itself a http(s) url, they are
assumed to share a username and password.

This avoids unnecessary duplicate password prompts.
This commit is contained in:
Joey Hess 2024-11-19 15:27:26 -04:00
parent 3510072883
commit b8a717a617
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
6 changed files with 55 additions and 4 deletions

View file

@ -20,6 +20,12 @@ as usual, and `remote.name.annexUrl` set to an annex+http url such as
"annex+http://example.com/git-annex/". The annex+http url is
served by this server, and uses port 9417 by default.
Note that, when `remote.name.url` and `remote.name.annexUrl`
contain the same hostname, they are assumed by git-annex to
support the same users and passwords. So, git-annex will use
the password for the `remote.name.url` to log into the
`remote.name.annexUrl`.
As well as serving the git-annex HTTP API, this server provides a
convenient way to download the content of any key, by using the path
"/git-annex/$uuid/$key". For example:

View file

@ -1569,6 +1569,13 @@ Remotes are configured using these settings in `.git/config`.
git operations. This allows using [[git-annex-p2phttp]] to serve a
git-annex repository over http.
When this and the `remote.<name>.url` contain the same hostname,
and this is an annex+http(s) url, and that is also a http(s) url,
git-annex assumes that the same username and password can be used
for both urls. When password cacheing is configured, this allows
you to only be prompted once for a password when using both git and
git-annex. See gitcredentials(7) for how to set up password caching.
* `remote.<name>.annex-uuid`
git-annex caches UUIDs of remote repositories here.

View file

@ -13,3 +13,6 @@ I see some ways to address this:
3. Perhaps most elegantly: make p2phttp support serving multiple repositories, so that repositories could share the same annexurl and therefore share credentials
[[!tag projects/INM7]]
> I have implemented reuse of the remote.name.url password for
> remote.name.annexurl when they are on the same host. [[done]] --[[Joey]]