Skip to content

Commit b068be7

Browse files
committed
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.
1 parent 7f19e4e commit b068be7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

setup.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1881,14 +1881,16 @@ const char *setup_git_directory_gently(int *nongit_ok)
18811881
break;
18821882
case GIT_DIR_HIT_CEILING:
18831883
if (!nongit_ok)
1884-
die(_("not a git repository (or any of the parent directories): %s"),
1884+
die(_("not a git repository (or any of the parent directories): %s\n"
1885+
"See also the 'git init' command for initializing a new repository."),
18851886
DEFAULT_GIT_DIR_ENVIRONMENT);
18861887
*nongit_ok = 1;
18871888
break;
18881889
case GIT_DIR_HIT_MOUNT_POINT:
18891890
if (!nongit_ok)
18901891
die(_("not a git repository (or any parent up to mount point %s)\n"
1891-
"Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)."),
1892+
"Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).\n"
1893+
"See also the 'git init' command for initializing a new repository."),
18921894
dir.buf);
18931895
*nongit_ok = 1;
18941896
break;

0 commit comments

Comments
 (0)