git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* fatal: unable to create '.git/index': File exists
@ 2007-01-05 16:50 Len Brown
  2007-01-05 17:30 ` Manu
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Len Brown @ 2007-01-05 16:50 UTC (permalink / raw)
  To: git

I kicked off a pull.
Realized I was on the wrong branch
and immediately did a ^C

Now I can't change branches:

# git checkout release
fatal: unable to create '.git/index': File exists
fatal: unable to create '.git/index': File exists

git reset --hard
does not help.

curiously, moving .git/index to /tmp and repeating
results in the same error.

clues?

thanks,
-Len

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

* Re: fatal: unable to create '.git/index': File exists
  2007-01-05 16:50 fatal: unable to create '.git/index': File exists Len Brown
@ 2007-01-05 17:30 ` Manu
  2007-01-05 20:16 ` Johannes Schindelin
  2007-01-06  3:01 ` Len Brown
  2 siblings, 0 replies; 5+ messages in thread
From: Manu @ 2007-01-05 17:30 UTC (permalink / raw)
  To: Len Brown; +Cc: git

Got this message once.
The reason was a git process still had a lock on the index file.
Make sure you have no git processes left running from the interruption
of git pull.

ps -ux | grep "git"

Manu

On 1/5/07, Len Brown <lenb@kernel.org> wrote:
> I kicked off a pull.
> Realized I was on the wrong branch
> and immediately did a ^C
>
> Now I can't change branches:
>
> # git checkout release
> fatal: unable to create '.git/index': File exists
> fatal: unable to create '.git/index': File exists
>
> git reset --hard
> does not help.
>
> curiously, moving .git/index to /tmp and repeating
> results in the same error.
>
> clues?
>
> thanks,
> -Len
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

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

* Re: fatal: unable to create '.git/index': File exists
  2007-01-05 16:50 fatal: unable to create '.git/index': File exists Len Brown
  2007-01-05 17:30 ` Manu
@ 2007-01-05 20:16 ` Johannes Schindelin
  2007-01-06  9:24   ` Fredrik Kuivinen
  2007-01-06  3:01 ` Len Brown
  2 siblings, 1 reply; 5+ messages in thread
From: Johannes Schindelin @ 2007-01-05 20:16 UTC (permalink / raw)
  To: Len Brown; +Cc: git

Hi,

On Fri, 5 Jan 2007, Len Brown wrote:

> I kicked off a pull.
> Realized I was on the wrong branch
> and immediately did a ^C
> 
> Now I can't change branches:
> 
> # git checkout release
> fatal: unable to create '.git/index': File exists

This usually means that .git/index.lock exists. Try removing that file.

However, it _should_ be removed by the atexit() handler, methinks. I have 
no idea why it does not.

Ciao,
Dscho

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

* Re: fatal: unable to create '.git/index': File exists
  2007-01-05 16:50 fatal: unable to create '.git/index': File exists Len Brown
  2007-01-05 17:30 ` Manu
  2007-01-05 20:16 ` Johannes Schindelin
@ 2007-01-06  3:01 ` Len Brown
  2 siblings, 0 replies; 5+ messages in thread
From: Len Brown @ 2007-01-06  3:01 UTC (permalink / raw)
  To: git

On Friday 05 January 2007 11:50, Len Brown wrote:
> I kicked off a pull.
> Realized I was on the wrong branch
> and immediately did a ^C
> 
> Now I can't change branches:
> 
> # git checkout release
> fatal: unable to create '.git/index': File exists
> fatal: unable to create '.git/index': File exists
> 
> git reset --hard
> does not help.
> 
> curiously, moving .git/index to /tmp and repeating
> results in the same error.

rm .git/index.lock
seemed to do the trick.
Hopefully nothing is toasted by this...

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

* Re: fatal: unable to create '.git/index': File exists
  2007-01-05 20:16 ` Johannes Schindelin
@ 2007-01-06  9:24   ` Fredrik Kuivinen
  0 siblings, 0 replies; 5+ messages in thread
From: Fredrik Kuivinen @ 2007-01-06  9:24 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Len Brown, git

On 1/5/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Fri, 5 Jan 2007, Len Brown wrote:
>
> > I kicked off a pull.
> > Realized I was on the wrong branch
> > and immediately did a ^C
> >
> > Now I can't change branches:
> >
> > # git checkout release
> > fatal: unable to create '.git/index': File exists
>
> This usually means that .git/index.lock exists. Try removing that file.
>
> However, it _should_ be removed by the atexit() handler, methinks. I have
> no idea why it does not.

We will get SIGINT when the user hits ^C so I don't think the atexit handler
will run. However, we also install a signal handler for SIGINT which removes
the lock file, so I don't really see how it can be left around...

There is a small race condition between open and signal as we do

    fd = open(lk->filename, O_RDWR | O_CREAT | O_EXCL, 0666);
    ...
    signal(SIGINT, remove_lock_file_on_signal);
    atexit(remove_lock_file);

in lock_file:lockfile.c. But I think it is very improbable that the user hits ^C
between  "open" and "signal". It might be worth fixing though.

Are there any other signals we might get when the user hits ^C? SIGPIPE?

- Fredrik

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

end of thread, other threads:[~2007-01-06  9:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-05 16:50 fatal: unable to create '.git/index': File exists Len Brown
2007-01-05 17:30 ` Manu
2007-01-05 20:16 ` Johannes Schindelin
2007-01-06  9:24   ` Fredrik Kuivinen
2007-01-06  3:01 ` Len Brown

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).