It is a pilot error to call `git config section.key value` outside of any Git worktree. Let's report that error instead of creating the .git/ directory and writing a fresh config into it. This addresses https://github.com/git-for-windows/git/issues/643 and https://groups.google.com/forum/#!topic/git-for-windows/fVRdnDIKVuw Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> --- I cannot think of a way how to test this: all of the regression tests run inside Git's own worktree, and we cannot even assume that /tmp/ is outside of a worktree (or that it exists). builtin/config.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/builtin/config.c b/builtin/config.c index adc7727..78aab95 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -352,6 +352,9 @@ static int get_colorbool(const char *var, int print) static void check_write(void) { + if (!given_config_source.file && !startup_info->have_repository) + die("not in a git directory"); + if (given_config_source.use_stdin) die("writing to stdin is not supported"); -- 2.7.2.windows.1.2.gbc859c8 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html