Felipe Contreras  committed d212ca1

git config: error when editing a repo config and not being in one

Let's throw an error on this specific case. If the user specifies the
config file, he must know what he is doing.

Teemu Likonen pointed this out.

Signed-off-by: Felipe Contreras <>
Signed-off-by: Junio C Hamano <>

  • Participants
  • Parent commits 2163e3f

Comments (0)

Files changed (1)

File builtin-config.c

 	else if (actions == ACTION_EDIT) {
 		check_argc(argc, 0, 0);
+		if (!config_exclusive_filename && nongit)
+			die("not in a git directory");
 		git_config(git_default_config, NULL);
 		launch_editor(config_exclusive_filename ?
 			      config_exclusive_filename : git_path("config"),