diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 237d7753df..98df56c889 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -883,9 +883,9 @@ class GitDownloadStrategy < VCSDownloadStrategy case @ref_type when :branch, :tag args << "--branch" << @ref - args << "-c" << "advice.detachedHead=false" # silences detached head warning end + args << "-c" << "advice.detachedHead=false" # silences detached head warning args << @url << cached_location end @@ -915,6 +915,9 @@ class GitDownloadStrategy < VCSDownloadStrategy command! "git", args: ["config", "remote.origin.tagOpt", "--no-tags"], chdir: cached_location + command! "git", + args: ["config", "advice.detachedHead", "false"], + chdir: cached_location end sig { params(timeout: T.nilable(Time)).void }