diff --git a/Documentation/config/advice.txt b/Documentation/config/advice.txt
index 257db58918179a..0b3199f4660886 100644
--- a/Documentation/config/advice.txt
+++ b/Documentation/config/advice.txt
@@ -64,6 +64,9 @@ all advice messages.
 		set their identity configuration.
 	mergeConflict::
 		Shown when various commands stop because of conflicts.
+	nameTooLong::
+		Advice shown if a filepath operation is attempted where the
+		path was too long.
 	nestedTag::
 		Shown when a user attempts to recursively tag a tag object.
 	pushAlreadyExists::
diff --git a/advice.c b/advice.c
index 1df43b7536fabe..e805653e859705 100644
--- a/advice.c
+++ b/advice.c
@@ -60,6 +60,7 @@ static struct {
 	[ADVICE_IGNORED_HOOK]				= { "ignoredHook" },
 	[ADVICE_IMPLICIT_IDENTITY]			= { "implicitIdentity" },
 	[ADVICE_MERGE_CONFLICT]				= { "mergeConflict" },
+	[ADVICE_NAME_TOO_LONG]				= { "nameTooLong" },
 	[ADVICE_NESTED_TAG]				= { "nestedTag" },
 	[ADVICE_OBJECT_NAME_WARNING]			= { "objectNameWarning" },
 	[ADVICE_PUSH_ALREADY_EXISTS]			= { "pushAlreadyExists" },
diff --git a/advice.h b/advice.h
index cf2284ec43864b..72a266d520d214 100644
--- a/advice.h
+++ b/advice.h
@@ -27,6 +27,7 @@ enum advice_type {
 	ADVICE_IGNORED_HOOK,
 	ADVICE_IMPLICIT_IDENTITY,
 	ADVICE_MERGE_CONFLICT,
+	ADVICE_NAME_TOO_LONG,
 	ADVICE_NESTED_TAG,
 	ADVICE_OBJECT_NAME_WARNING,
 	ADVICE_PUSH_ALREADY_EXISTS,
diff --git a/builtin/clean.c b/builtin/clean.c
index f83cc6760c6231..9059c142b36b63 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -25,6 +25,7 @@
 #include "pathspec.h"
 #include "help.h"
 #include "prompt.h"
+#include "advice.h"
 
 static int require_force = -1; /* unset */
 static int interactive;
@@ -220,6 +221,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
 			quote_path(path->buf, prefix, &quoted, 0);
 			errno = saved_errno;
 			warning_errno(_(msg_warn_remove_failed), quoted.buf);
+			if (saved_errno == ENAMETOOLONG) {
+				advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed."));
+			}
 			*dir_gone = 0;
 		}
 		ret = res;
@@ -255,6 +259,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
 				quote_path(path->buf, prefix, &quoted, 0);
 				errno = saved_errno;
 				warning_errno(_(msg_warn_remove_failed), quoted.buf);
+				if (saved_errno == ENAMETOOLONG) {
+					advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed."));
+				}
 				*dir_gone = 0;
 				ret = 1;
 			}
@@ -298,6 +305,9 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
 				quote_path(path->buf, prefix, &quoted, 0);
 				errno = saved_errno;
 				warning_errno(_(msg_warn_remove_failed), quoted.buf);
+				if (saved_errno == ENAMETOOLONG) {
+					advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed."));
+				}
 				*dir_gone = 0;
 				ret = 1;
 			}
@@ -1110,6 +1120,9 @@ int cmd_clean(int argc,
 				qname = quote_path(item->string, NULL, &buf, 0);
 				errno = saved_errno;
 				warning_errno(_(msg_warn_remove_failed), qname);
+				if (saved_errno == ENAMETOOLONG) {
+					advise_if_enabled(ADVICE_NAME_TOO_LONG, _("Setting `core.longPaths` may allow the deletion to succeed."));
+				}
 				errors++;
 			} else if (!quiet) {
 				qname = quote_path(item->string, NULL, &buf, 0);