# Locking the repository

2 messages from 2005-05-06 to 2005-05-06. Participants: Thomas Glanzmann, Linus Torvalds.
Thread: https://gitlist.dev/t/498

## Thomas Glanzmann, 2005-05-06 12:31

Subject: Locking the repository
Message-ID: <20050506123122.GF11506@cip.informatik.uni-erlangen.de>
URL: https://gitlist.dev/e/20050506123122.GF11506%40cip.informatik.uni-erlangen.de

```
Hello,
I need a way to lock a repository for certain actions. What can I use to
obtain this? Is there a way to use rsync for that? It should also be
NFS-safe. Are there are any classic unix tools that I can use for this?

	Thomas

```

## Linus Torvalds, 2005-05-06 16:15

Subject: Re: Locking the repository
Message-ID: <Pine.LNX.4.58.0505060913460.2233@ppc970.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.58.0505060913460.2233%40ppc970.osdl.org
In-Reply-To: <20050506123122.GF11506@cip.informatik.uni-erlangen.de>

```


On Fri, 6 May 2005, Thomas Glanzmann wrote:
>
> I need a way to lock a repository for certain actions.

Nope - if you want to serialize something, you'll need to write your own 
serialization scripts. git doesn't care, because all the git operations 
should be totally lockless already. There just isn't any reason to lock as 
far as git is concerned, since the objects are immutable.

The only exception is the "index" file, where we don't want concurrect 
index updates. So that is handled by writers creating the new "index.lock" 
file first, and then when they are done, they rename it to "index".

		Linus

```
