git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Remembering which http remotes require authentication
@ 2023-06-12  6:47 M Hickford
  2023-06-12 21:21 ` brian m. carlson
  2023-06-12 22:12 ` Junio C Hamano
  0 siblings, 2 replies; 5+ messages in thread
From: M Hickford @ 2023-06-12  6:47 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Jeff King

Most http remotes require authentication to push. Private repositories
also require authentication to fetch.

If I understand correctly, http_request_reauth [1] first makes an
unauthenticated http request. If this fails with error 401
Unauthorized, then Git retries with authentication. This avoids
potentially expensive `credential fill` unless necessary. (`credential
fill` may be fast, slow or even require user input)

Could Git remember which remotes require authentication for which
operations? On high-latency networks such as 3G or satellite
connections [2], skipping a doomed unauthenticated request could
potentially halve the time taken for some commands.

A complication: if a repository changed from private to public, Git
would continue to authenticate when no longer necessary. A solution
could be to remember to skip the unauthenticated request for a limited
amount of time, or a maximum number of requests, before rechecking.

[1] https://github.com/git/git/blob/fe86abd7511a9a6862d5706c6fa1d9b57a63ba09/http.c#L2123-L2169
[2] https://hpbn.co/primer-on-latency-and-bandwidth/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-21 10:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-12  6:47 Remembering which http remotes require authentication M Hickford
2023-06-12 21:21 ` brian m. carlson
     [not found]   ` <CAGJzqsnMnJqed8ztiCAS9oDXNMmT73=8caXXsDKeYmxevsQMjg@mail.gmail.com>
2023-06-21 10:09     ` brian m. carlson
2023-06-12 22:12 ` Junio C Hamano
2023-06-21  6:30   ` M Hickford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).