git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: preventing a push

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Dec 18, 2007, 16:32 UTC
Message-ID
<alpine.LFD.0.9999.0712180819480.21557@woody.linux-foundation.org>
In-Reply-To
<4767BDD8.9080404@melosgmbh.de>
On Tue, 18 Dec 2007, Christoph Duelli wrote:
>
> Is there a (recommended?) way to prevent accidental pushing (or pulling) from
> one repository into another (like the level command from bk days)?

I used BK for years, never knew about any level thing. I assume that was some way to introduce an "ordering" between repositories, where you could only push/pull in a controlled manner?

There's no obvious way to do exactly that, but the hooks git has may or may not be ok. For example, if you want to disallow pushing into some repository entirely (because you _only_ expect people to pull into it), you should be able to just make a "pre-receive" hook that always returns false. See Documentation/hooks.txt.

NOTE! There is no way to figure out what the pushing repository status is, which is why I say there is no way to do a "level"-equivalent thing (assuming I guessed what "level" does from the name). However, depending on how you allow people to access the machine, the hook obviously can look at things like $USER or other environment variables (ie you could make it look at what machine the user connected from etc).

But nothing really ever identifies the source repository (on a "git level") for a push: as far as git is concerned, all repositories are equal, and your hooks would invariably have to use non-git knowledge to figure out whether some operation should be allowed or not.

		Linus
Previous: Christoph DuelliNext: Christoph Duelli
Message 2 of 3 in “preventing a push”
  1. Christoph DuelliDec 18, 2007
  2. Linus TorvaldsDec 18, 2007
  3. Christoph DuelliDec 18, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.