From da04081b69536decb88b8306a6ff9206b07ee36d Mon Sep 17 00:00:00 2001 From: Allen Li Date: Wed, 15 Jan 2025 14:15:24 -0800 Subject: [PATCH] [gclient] Handle auth setup for cached repos Bug: b/389733575 Change-Id: I3b65d380551cbc23746e285d082076514edebf5d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6169811 Commit-Queue: Allen Li Reviewed-by: Josip Sokcevic --- gclient_scm.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gclient_scm.py b/gclient_scm.py index 004a808c0..416eb3138 100644 --- a/gclient_scm.py +++ b/gclient_scm.py @@ -1369,7 +1369,11 @@ class GitWrapper(SCMWrapper): # Set up Git authentication configuration that is needed to clone/fetch the repo. if newauth.Enabled(): - git_auth.ConfigureGlobal('/', url) + # We need the host from the URL to determine auth settings. + # The url parameter might have been re-written to a local + # cache directory, so we need self.url, which contains the + # original remote URL. + git_auth.ConfigureGlobal('/', self.url) if hasattr(options, 'no_history') and options.no_history: self._Run(['init', self.checkout_path], options, cwd=self._root_dir)