diff --git a/.changes/unreleased/Fixes-20240215-103838.yaml b/.changes/unreleased/Fixes-20240215-103838.yaml new file mode 100644 index 00000000000..eb79c71ce14 --- /dev/null +++ b/.changes/unreleased/Fixes-20240215-103838.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Fix unexpected error message when git is not installed +time: 2024-02-15T10:38:38.01821-07:00 +custom: + Author: jon-fearer + Issue: "9537" diff --git a/core/dbt/task/debug.py b/core/dbt/task/debug.py index ea0f636bd6c..21bac27069e 100644 --- a/core/dbt/task/debug.py +++ b/core/dbt/task/debug.py @@ -406,6 +406,17 @@ def test_git(self) -> SubtaskStatus: details="git error", summary_message="Error from git --help: {!s}".format(exc), ) + except dbt_common.exceptions.CommandResultError as exc: + return SubtaskStatus( + log_msg=red("ERROR"), + run_status=RunStatus.Error, + details="git error", + summary_message=( + "Error from git --help: {!s}\n" + "Make sure that `git` is installed in your shell " + "and that `git --help` can execute successfully." + ).format(exc), + ) else: return SubtaskStatus( log_msg=green("OK found"),