Skip to content

Adjust update to honor custom SSH command#21822

Open
sfc-gh-ksmogor wants to merge 3 commits intoHomebrew:mainfrom
sfc-gh-ksmogor:patch-1
Open

Adjust update to honor custom SSH command#21822
sfc-gh-ksmogor wants to merge 3 commits intoHomebrew:mainfrom
sfc-gh-ksmogor:patch-1

Conversation

@sfc-gh-ksmogor
Copy link

@sfc-gh-ksmogor sfc-gh-ksmogor commented Mar 24, 2026

In my use case I use custom ssh command to access homebrew repositories (set as a global config in ~/.gitconfig file). Current brew update doesn't work with my custom repository because of wrong credentials. Tapping still works as expected.
It turned out that setting up explicit GIT_SSH_COMMAND=${GIT_SSH_COMMAND:-ssh} -oBatchMode=yes overrides global git config. Additionally, I couldn't override the default ssh command by exporting GIT_SSH_COMMAND. It happened because the flag wasn't whitelisted.

I propose to fix two things:

  1. Add GIT_SSH_COMMAND to whitelisted list of envs. Currently passing this flag is dead logic without whitelisting.
  2. Check whether the git config have custom ssh command. If so, doesn't override it. Use -oBatchMode only when default ssh implementation is used. Otherwise brew can break custom wrapper by adding ssh-only flag.

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests (excluding integration tests) for your changes? Here's an example. Couldn't find bash scripts tests for update.sh.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes.
    Used for searching the code through and diagnosing the problem with passing the flag to update (comparison between tap and update, suggesting the change when problem was pinned down by local modification).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant