Clear local error variable after invoking giterr_clear().
diff --git a/src/repository.c b/src/repository.c
index 46b7f8f..2c567c8 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -1015,6 +1015,7 @@ static int repo_init_structure(
/* if template was default, ignore error and use internal */
giterr_clear();
external_tpl = false;
+ error = 0;
}
}