In this case, because we use "include.onbranch" configuration, the "config.c::include_by_branch" will use "refsc::get_main_ref_store" to get the refname. However, the repo does not exist, so we cannot find any ref backend. The main problem is that we never check whether "the_repository->gitdir" is a git directory in "config.c::include_by_branch". So, we do not need to check the value of the option "--git-dir". Thanks, Jialuo