The pack-*.keep files are temporary, and serve no purpose in the
clone.  They would probably also never be deleted from the clone if
copied, since the process that created them only expects to have to
delete them from the original repository.

Worse, though, they are created with access bits 0600, so if the
user trying to clone the repository is different from the user that
caused the pack-*.keep file to be created, the clone will likely
fail due to not being allowed to read (and thus copy) the file in
the first place.

Signed-off-by: Jens Lindstrom <>
 builtin/clone.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/builtin/clone.c b/builtin/clone.c
index 035ab64..0ec0ec9 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -342,6 +342,11 @@ static void copy_or_link_directory(struct strbuf *src, 
struct strbuf *dest,
+               /* Skip pack-*.keep files, they are temporary and not
+                  relevant to the clone, and might not be accessible. */
+               if (!strcmp(src->buf + strlen(src->buf) - 5, ".keep"))
+                       continue;
                /* Files that cannot be copied bit-for-bit... */
                if (!strcmp(src->buf + src_baselen, "/info/alternates")) {
                        copy_alternates(src, dest, src_repo);

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to