# git clone error

2 messages from 2008-04-05 to 2008-04-05. Participants: Chuck Ritter, Junio C Hamano.
Thread: https://gitlist.dev/t/12994

## Chuck Ritter, 2008-04-05 17:20

Subject: git clone error
Message-ID: <a00d3c7f0804051020u366e978ei7252c904c48461f6@mail.gmail.com>
URL: https://gitlist.dev/e/a00d3c7f0804051020u366e978ei7252c904c48461f6%40mail.gmail.com

```
Hello,

I'm getting an error when I try to clone a git repo:

$ git clone ~dab143/src/OVER-REL/SOURCE-GIT-TEST OVER-REL
Initialized empty Git repository in /home/cfr100/OVER-REL/.git/
cpio: objects/pack/pack-80a0460fc07be5e0628b02549fdaa186b792d3f3.keep:
Permission denied
888 blocks

# cat pack-80a0460fc07be5e0628b02549fdaa186b792d3f3.keep
fetch-pack 31620 on githost.arl.psu.edu

Permission on the keep file are 600. Of course this looks like a stale
lock of some sort.

We are using git version 1.5.4.1. The owner of the repository had
pushed changes to it from msysgit under Windows. I am not sure of the
version. It worked fine before that.

Is this an issue I should take up with the msysgit developers?

Once in this state what is the best way to resolve it and verify the
integrity of the repository?

Thanks
Chuck

```

## Junio C Hamano, 2008-04-05 20:09

Subject: Re: git clone error
Message-ID: <7vabk8vzby.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vabk8vzby.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <a00d3c7f0804051020u366e978ei7252c904c48461f6@mail.gmail.com>

```
"Chuck Ritter" <cfr100@psu.edu> writes:

> $ git clone ~dab143/src/OVER-REL/SOURCE-GIT-TEST OVER-REL
> Initialized empty Git repository in /home/cfr100/OVER-REL/.git/
> cpio: objects/pack/pack-80a0460fc07be5e0628b02549fdaa186b792d3f3.keep:
> Permission denied
> 888 blocks
>
> # cat pack-80a0460fc07be5e0628b02549fdaa186b792d3f3.keep
> fetch-pack 31620 on githost.arl.psu.edu
>
> Permission on the keep file are 600. Of course this looks like a stale
> lock of some sort.

The original repository you are cloning from is owned by somebody else,
and a file in it is not readable by you.  Bad.

No, .keep is not a stale lock.  It is active and valid --- do not
remove it --- it prevents the corresponding pack from being subject to
repacking.

The bug is that index-pack.c::final() tries to make the resulting pack and
idx readable with chmod(0444), but it forgets to make .keep readable.

To unblock you, you would need to ask the user "dab143" to make the
repository readable by you; the damage has already been done.  There may
be files other than that .keep file that is unreadable.

The following patch would prevent the breakage the repository you are
trying to clone from is suffering from happening again.

---

 index-pack.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/index-pack.c b/index-pack.c
index 9c0c278..9dc3cfd 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -720,6 +720,7 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
 				die("cannot write keep file");
 			report = "keep";
 		}
+		chmod(keep_name, 0444);
 	}
 
 	if (final_pack_name != curr_pack_name) {

```
