Check if default branch matches refspec
diff --git a/src/clone.c b/src/clone.c
index 962cf12..e29a4aa 100644
--- a/src/clone.c
+++ b/src/clone.c
@@ -285,6 +285,9 @@ static int update_head_to_branch(
if ((retcode = git_remote_default_branch(&default_branch, remote)) < 0)
goto cleanup;
+ if (!git_remote__matching_refspec(remote, git_buf_cstr(&default_branch)))
+ goto cleanup;
+
retcode = update_remote_head(repo, remote, &default_branch, reflog_message);
cleanup: