From b068be71a063e2290e85cfad3a1922ab96a98216 Mon Sep 17 00:00:00 2001 From: Aaryan Bansal Date: Wed, 11 Mar 2026 22:00:41 +0530 Subject: [PATCH] setup: suggest 'git init' when no repository is found When Git cannot find a .git directory, the error message now includes a helpful hint suggesting to run 'git init' to initialize a new repository. This helps new developers understand what to do when they encounter this common error. This follows the pattern established by the 'detected dubious ownership' error message which provides actionable guidance to users. --- setup.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.c b/setup.c index 393b970ae4f96d..324a312ae8bff3 100644 --- a/setup.c +++ b/setup.c @@ -1881,14 +1881,16 @@ const char *setup_git_directory_gently(int *nongit_ok) break; case GIT_DIR_HIT_CEILING: if (!nongit_ok) - die(_("not a git repository (or any of the parent directories): %s"), + die(_("not a git repository (or any of the parent directories): %s\n" + "See also the 'git init' command for initializing a new repository."), DEFAULT_GIT_DIR_ENVIRONMENT); *nongit_ok = 1; break; case GIT_DIR_HIT_MOUNT_POINT: if (!nongit_ok) die(_("not a git repository (or any parent up to mount point %s)\n" - "Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)."), + "Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).\n" + "See also the 'git init' command for initializing a new repository."), dir.buf); *nongit_ok = 1; break;