diff --git a/git-clone.sh b/git-clone.sh
index 3d388de62a9..cf761b2c694 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -355,7 +355,7 @@ then
 	# The name under $remote_top the remote HEAD seems to point at.
 	head_points_at=$(
 		(
-			echo "master"
+			test -f "$GIT_DIR/$remote_top/master" && echo "master"
 			cd "$GIT_DIR/$remote_top" &&
 			find . -type f -print | sed -e 's/^\.\///'
 		) | (