git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Fixing a broken GIT repo
@ 2011-11-18 10:54 Bart van den Burg
  2011-11-18 12:54 ` Felipe Contreras
  2011-11-18 13:49 ` Johannes Sixt
  0 siblings, 2 replies; 5+ messages in thread
From: Bart van den Burg @ 2011-11-18 10:54 UTC (permalink / raw)
  To: git

Hi

I somehow managed to break my GIT repo. Whenever I try to clone or fetch 
from a clean local repo, I get an error.

I'm able to go back on the server, to the very last commit where 
everything works, but as soon as I make a change locally and push it, it 
breaks again. I've been trying to figure out what's wrong here for about 
two days now, but I'm completely lost.

Here's the steps I take to reproduce the problem.

On the server, I can reset the ref to the last working commit:

git@server:~/shifter_rai.git$ echo 
"cc5693a275c25003edc77b59f5a5c603a857f711" > refs/heads/master

Then, on my local computer, I can clone fine, but after making a commit, 
it breaks again:

bbu@SIT-WST-05 /d/workspace9
$ git clone git@git.samson-it.nl:/home/git/shifter_rai
Cloning into shifter_rai...
remote: Counting objects: 9557, done.
remote: Compressing objects: 100% (1887/1887), done.
remote: Total 9557 (delta 7107), reused 9397 (delta 7019)
Receiving objects: 100% (9557/9557), 2.85 MiB | 1.06 MiB/s, done.
Resolving deltas: 100% (7107/7107), done.

bbu@SIT-WST-05 /d/workspace9
$ cd shifter_rai/

bbu@SIT-WST-05 /d/workspace9/shifter_rai (master)
$ echo "test" > test

bbu@SIT-WST-05 /d/workspace9/shifter_rai (master)
$ git add test
warning: LF will be replaced by CRLF in test.
The file will have its original line endings in your working directory.

bbu@SIT-WST-05 /d/workspace9/shifter_rai (master)
$ git commit
[master 85d1ee9] test
warning: LF will be replaced by CRLF in test.
The file will have its original line endings in your working directory.
  1 files changed, 1 insertions(+), 0 deletions(-)
  create mode 100644 test

bbu@SIT-WST-05 /d/workspace9/shifter_rai (master)
$ git push
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 271 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
To git@git.samson-it.nl:/home/git/shifter_rai
    cc5693a..85d1ee9  master -> master

bbu@SIT-WST-05 /d/workspace9/shifter_rai (master)
$ cd ..

bbu@SIT-WST-05 /d/workspace9
$ rm -rf shifter_rai/

bbu@SIT-WST-05 /d/workspace9
$ git clone git@git.samson-it.nl:/home/git/shifter_rai
Cloning into shifter_rai...
remote: Counting objects: 9557, done.
remote: Compressing objects: 100% (1887/1887), done.
remote: Total 9557 (delta 7107), reused 9397 (delta 7019)
Receiving objects: 100% (9557/9557), 2.85 MiB | 1.16 MiB/s, done.
Resolving deltas: 100% (7107/7107), done.
error: refs/remotes/origin/master does not point to a valid object!
error: Trying to write ref refs/heads/master with nonexistant object 
85d1ee957c65485ed9c937a4f1bfdd44fda4ea35
fatal: Cannot update the ref 'HEAD'.

Needless to say, the mentioned object in fact does exist on the server:
git@server:~/shifter_rai.git$ ls -la 
objects/85/d1ee957c65485ed9c937a4f1bfdd44fda4ea35
-r--r--r-- 1 git git 153 Nov 18 11:39 
objects/85/d1ee957c65485ed9c937a4f1bfdd44fda4ea35

Can anyone tell me what is happening here, and how I can fix it?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Fixing a broken GIT repo
  2011-11-18 10:54 Fixing a broken GIT repo Bart van den Burg
@ 2011-11-18 12:54 ` Felipe Contreras
  2011-11-18 13:49 ` Johannes Sixt
  1 sibling, 0 replies; 5+ messages in thread
From: Felipe Contreras @ 2011-11-18 12:54 UTC (permalink / raw)
  To: Bart van den Burg; +Cc: git

On Fri, Nov 18, 2011 at 12:54 PM, Bart van den Burg <bart@burgov.nl> wrote:
> Needless to say, the mentioned object in fact does exist on the server:
> git@server:~/shifter_rai.git$ ls -la
> objects/85/d1ee957c65485ed9c937a4f1bfdd44fda4ea35
> -r--r--r-- 1 git git 153 Nov 18 11:39
> objects/85/d1ee957c65485ed9c937a4f1bfdd44fda4ea35
>
> Can anyone tell me what is happening here, and how I can fix it?

Well, if you can't find that object on the server or your local box,
then you would have to find the last commit that worked, and reset the
'master' branch to that.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Fixing a broken GIT repo
  2011-11-18 10:54 Fixing a broken GIT repo Bart van den Burg
  2011-11-18 12:54 ` Felipe Contreras
@ 2011-11-18 13:49 ` Johannes Sixt
  2011-11-21 16:37   ` Erik Faye-Lund
  1 sibling, 1 reply; 5+ messages in thread
From: Johannes Sixt @ 2011-11-18 13:49 UTC (permalink / raw)
  To: Bart van den Burg; +Cc: git

Am 11/18/2011 11:54, schrieb Bart van den Burg:
> I somehow managed to break my GIT repo. Whenever I try to clone or fetch
> from a clean local repo, I get an error.
> 
> I'm able to go back on the server, to the very last commit where
> everything works, but as soon as I make a change locally and push it, it
> breaks again.
...
> $ git clone git@git.samson-it.nl:/home/git/shifter_rai
...
> Receiving objects: 100% (9557/9557), 2.85 MiB | 1.06 MiB/s, done.
...
> $ git push
> Counting objects: 4, done.
> Delta compression using up to 4 threads.
> Compressing objects: 100% (2/2), done.
> Writing objects: 100% (3/3), 271 bytes, done.
> Total 3 (delta 1), reused 0 (delta 0)
> To git@git.samson-it.nl:/home/git/shifter_rai
>    cc5693a..85d1ee9  master -> master

It looks like you are pushing via git protocol from Windows
(Git-for-Windows). This is known to dead-lock in most cases, and even
though it did not here, I would not be surprised if it had other issues.

Do not do it. Push via ssh instead.

> bbu@SIT-WST-05 /d/workspace9
> $ git clone git@git.samson-it.nl:/home/git/shifter_rai
> Cloning into shifter_rai...
> remote: Counting objects: 9557, done.
> remote: Compressing objects: 100% (1887/1887), done.
> remote: Total 9557 (delta 7107), reused 9397 (delta 7019)
> Receiving objects: 100% (9557/9557), 2.85 MiB | 1.16 MiB/s, done.
> Resolving deltas: 100% (7107/7107), done.

Did you notice that this downloaded the exact same number of objects as
the first clone? There should have been at least 9558, but most likely
9560 objects. There's something fishy.

> error: refs/remotes/origin/master does not point to a valid object!
> error: Trying to write ref refs/heads/master with nonexistant object
> 85d1ee957c65485ed9c937a4f1bfdd44fda4ea35
> fatal: Cannot update the ref 'HEAD'.
>
> Needless to say, the mentioned object in fact does exist on the server:
> git@server:~/shifter_rai.git$ ls -la
> objects/85/d1ee957c65485ed9c937a4f1bfdd44fda4ea35
> -r--r--r-- 1 git git 153 Nov 18 11:39
> objects/85/d1ee957c65485ed9c937a4f1bfdd44fda4ea35

Does git fsck --full on the server indeed report a good repository? Can
you clone this repository to a different client?

-- Hannes

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Fixing a broken GIT repo
  2011-11-18 13:49 ` Johannes Sixt
@ 2011-11-21 16:37   ` Erik Faye-Lund
  2011-11-21 16:45     ` Johannes Sixt
  0 siblings, 1 reply; 5+ messages in thread
From: Erik Faye-Lund @ 2011-11-21 16:37 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Bart van den Burg, git

On Fri, Nov 18, 2011 at 2:49 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:
> Am 11/18/2011 11:54, schrieb Bart van den Burg:
>> I somehow managed to break my GIT repo. Whenever I try to clone or fetch
>> from a clean local repo, I get an error.
>>
>> I'm able to go back on the server, to the very last commit where
>> everything works, but as soon as I make a change locally and push it, it
>> breaks again.
> ...
>> $ git clone git@git.samson-it.nl:/home/git/shifter_rai
> ...
>> Receiving objects: 100% (9557/9557), 2.85 MiB | 1.06 MiB/s, done.
> ...
>> $ git push
>> Counting objects: 4, done.
>> Delta compression using up to 4 threads.
>> Compressing objects: 100% (2/2), done.
>> Writing objects: 100% (3/3), 271 bytes, done.
>> Total 3 (delta 1), reused 0 (delta 0)
>> To git@git.samson-it.nl:/home/git/shifter_rai
>>    cc5693a..85d1ee9  master -> master
>
> It looks like you are pushing via git protocol from Windows
> (Git-for-Windows). This is known to dead-lock in most cases, and even
> though it did not here, I would not be surprised if it had other issues.
>
> Do not do it. Push via ssh instead.
>

Does it? Doesn't the "To git@git.samson-it.nl:/home/git/shifter_rai"
line suggests ssh?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Fixing a broken GIT repo
  2011-11-21 16:37   ` Erik Faye-Lund
@ 2011-11-21 16:45     ` Johannes Sixt
  0 siblings, 0 replies; 5+ messages in thread
From: Johannes Sixt @ 2011-11-21 16:45 UTC (permalink / raw)
  To: kusmabite; +Cc: Bart van den Burg, git

Am 11/21/2011 17:37, schrieb Erik Faye-Lund:
> On Fri, Nov 18, 2011 at 2:49 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:
>> Am 11/18/2011 11:54, schrieb Bart van den Burg:
>>> To git@git.samson-it.nl:/home/git/shifter_rai
>>>    cc5693a..85d1ee9  master -> master
>>
>> It looks like you are pushing via git protocol from Windows
>> (Git-for-Windows). This is known to dead-lock in most cases, and even
>> though it did not here, I would not be surprised if it had other issues.
>>
>> Do not do it. Push via ssh instead.
>>
> 
> Does it? Doesn't the "To git@git.samson-it.nl:/home/git/shifter_rai"
> line suggests ssh?

Oops, you are right.

-- Hannes

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-11-21 16:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-18 10:54 Fixing a broken GIT repo Bart van den Burg
2011-11-18 12:54 ` Felipe Contreras
2011-11-18 13:49 ` Johannes Sixt
2011-11-21 16:37   ` Erik Faye-Lund
2011-11-21 16:45     ` Johannes Sixt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).