Add HOMEBREW_SSH_CONFIG_PATH

This allows specifying the path of an SSH config file that Homebrew should use instead of the default, `~/.ssh/config`, when fetching Git repos over SSH.
This commit is contained in:
Bob Lail 2021-10-19 08:35:12 -05:00 committed by Mike McQuaid
parent e771571d69
commit c3e48b004d
No known key found for this signature in database
GPG Key ID: 3338A31AFDB1D829
5 changed files with 26 additions and 1 deletions

View File

@ -794,6 +794,12 @@ fi
source "${HOMEBREW_LIBRARY}/Homebrew/utils/analytics.sh" source "${HOMEBREW_LIBRARY}/Homebrew/utils/analytics.sh"
setup-analytics setup-analytics
# Use this configuration file instead of ~/.ssh/config when fetching git over SSH.
if [[ -n "${HOMEBREW_SSH_CONFIG_PATH}" ]]
then
export GIT_SSH_COMMAND="ssh -F${HOMEBREW_SSH_CONFIG_PATH}"
fi
if [[ -n "${HOMEBREW_BASH_COMMAND}" ]] if [[ -n "${HOMEBREW_BASH_COMMAND}" ]]
then then
# source rather than executing directly to ensure the entire file is read into # source rather than executing directly to ensure the entire file is read into

View File

@ -455,7 +455,7 @@ EOS
fi fi
export GIT_TERMINAL_PROMPT="0" export GIT_TERMINAL_PROMPT="0"
export GIT_SSH_COMMAND="ssh -oBatchMode=yes" export GIT_SSH_COMMAND="${GIT_SSH_COMMAND:-ssh} -oBatchMode=yes"
if [[ -n "${HOMEBREW_GIT_NAME}" ]] if [[ -n "${HOMEBREW_GIT_NAME}" ]]
then then

View File

@ -282,6 +282,11 @@ module Homebrew
description: "If set, running Homebrew on Linux will use homebrew-core instead of linuxbrew-core.", description: "If set, running Homebrew on Linux will use homebrew-core instead of linuxbrew-core.",
boolean: true, boolean: true,
}, },
HOMEBREW_SSH_CONFIG_PATH: {
description: "If set, Homebrew will use the given config file instead of `~/.ssh/config` when fetching " \
"`git` repos over `ssh`.",
default_text: "`$HOME/.ssh/config`",
},
HOMEBREW_SKIP_OR_LATER_BOTTLES: { HOMEBREW_SKIP_OR_LATER_BOTTLES: {
description: "If set along with `HOMEBREW_DEVELOPER`, do not use bottles from older versions " \ description: "If set along with `HOMEBREW_DEVELOPER`, do not use bottles from older versions " \
"of macOS. This is useful in development on new macOS versions.", "of macOS. This is useful in development on new macOS versions.",

View File

@ -2086,6 +2086,11 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
- `HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX` - `HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX`
<br>If set, running Homebrew on Linux will use homebrew-core instead of linuxbrew-core. <br>If set, running Homebrew on Linux will use homebrew-core instead of linuxbrew-core.
- `HOMEBREW_SSH_CONFIG_PATH`
<br>If set, Homebrew will use the given config file instead of `~/.ssh/config` when fetching `git` repos over `ssh`.
*Default:* `$HOME/.ssh/config`
- `HOMEBREW_SKIP_OR_LATER_BOTTLES` - `HOMEBREW_SKIP_OR_LATER_BOTTLES`
<br>If set along with `HOMEBREW_DEVELOPER`, do not use bottles from older versions of macOS. This is useful in development on new macOS versions. <br>If set along with `HOMEBREW_DEVELOPER`, do not use bottles from older versions of macOS. This is useful in development on new macOS versions.

View File

@ -3038,6 +3038,15 @@ If set, running Homebrew on Linux will simulate certain macOS code paths\. This
If set, running Homebrew on Linux will use homebrew\-core instead of linuxbrew\-core\. If set, running Homebrew on Linux will use homebrew\-core instead of linuxbrew\-core\.
. .
.TP .TP
\fBHOMEBREW_SSH_CONFIG_PATH\fR
.
.br
If set, Homebrew will use the given config file instead of \fB~/\.ssh/config\fR when fetching \fBgit\fR repos over \fBssh\fR\.
.
.IP
\fIDefault:\fR \fB$HOME/\.ssh/config\fR
.
.TP
\fBHOMEBREW_SKIP_OR_LATER_BOTTLES\fR \fBHOMEBREW_SKIP_OR_LATER_BOTTLES\fR
. .
.br .br