{"thread":{"id":"11341","subject":"preventing a push","startedAt":"2007-12-18T12:32:24Z","lastAt":"2007-12-18T16:53:10Z","messageCount":3,"participants":["Christoph Duelli","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"63599","messageId":"4767BDD8.9080404@melosgmbh.de","threadId":"11341","inReplyTo":null,"subject":"preventing a push","fromName":"Christoph Duelli","fromEmail":"duelli@melosgmbh.de","sentAt":"2007-12-18T12:32:24Z","receivedAt":"2007-12-18T12:32:24Z","isPatch":false,"sender":{"key":"duelli@melosgmbh.de","avatar":null},"body":"Is there a (recommended?) way to prevent accidental pushing (or pulling) \nfrom one repository into another (like the level command from bk days)?\n\nBest regards\nChristoph\n"},{"id":"63635","messageId":"alpine.LFD.0.9999.0712180819480.21557@woody.linux-foundation.org","threadId":"11341","inReplyTo":"4767BDD8.9080404@melosgmbh.de","subject":"Re: preventing a push","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-12-18T16:32:55Z","receivedAt":"2007-12-18T16:32:55Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 18 Dec 2007, Christoph Duelli wrote:\n>\n> Is there a (recommended?) way to prevent accidental pushing (or pulling) from\n> one repository into another (like the level command from bk days)?\n\nI used BK for years, never knew about any level thing. I assume that was \nsome way to introduce an \"ordering\" between repositories, where you could \nonly push/pull in a controlled manner?\n\nThere's no obvious way to do exactly that, but the hooks git has may or \nmay not be ok. For example, if you want to disallow pushing into some \nrepository entirely (because you _only_ expect people to pull into it), \nyou should be able to just make a \"pre-receive\" hook that always returns \nfalse. See Documentation/hooks.txt.\n\nNOTE! There is no way to figure out what the pushing repository status is, \nwhich is why I say there is no way to do a \"level\"-equivalent thing \n(assuming I guessed what \"level\" does from the name). However, depending \non how you allow people to access the machine, the hook obviously can look \nat things like $USER or other environment variables (ie you could make it \nlook at what machine the user connected from etc).\n\nBut nothing really ever identifies the source repository (on a \"git \nlevel\") for a push: as far as git is concerned, all repositories are \nequal, and your hooks would invariably have to use non-git knowledge to \nfigure out whether some operation should be allowed or not.\n\n\t\tLinus\n"},{"id":"63640","messageId":"4767FAF6.6050204@melosgmbh.de","threadId":"11341","inReplyTo":"alpine.LFD.0.9999.0712180819480.21557@woody.linux-foundation.org","subject":"Re: preventing a push","fromName":"Christoph Duelli","fromEmail":"duelli@melosgmbh.de","sentAt":"2007-12-18T16:53:10Z","receivedAt":"2007-12-18T16:53:10Z","isPatch":false,"sender":{"key":"duelli@melosgmbh.de","avatar":null},"body":"Linus Torvalds schrieb:\n> \n> On Tue, 18 Dec 2007, Christoph Duelli wrote:\n>> Is there a (recommended?) way to prevent accidental pushing (or pulling) from\n>> one repository into another (like the level command from bk days)?\n> \n> I used BK for years, never knew about any level thing. I assume that was \n> some way to introduce an \"ordering\" between repositories, where you could \n> only push/pull in a controlled manner?\nIndeed, you can not move changes to a repo with a lower level.\n\n> There's no obvious way to do exactly that, but the hooks git has may or \n> may not be ok. For example, if you want to disallow pushing into some \n> repository entirely (because you _only_ expect people to pull into it), \n> you should be able to just make a \"pre-receive\" hook that always returns \n> false. See Documentation/hooks.txt.\nOk, I will give hooks a try here.\n\n> NOTE! There is no way to figure out what the pushing repository status is, \n> which is why I say there is no way to do a \"level\"-equivalent thing \n> (assuming I guessed what \"level\" does from the name). However, depending \n> on how you allow people to access the machine, the hook obviously can look \n> at things like $USER or other environment variables (ie you could make it \n> look at what machine the user connected from etc).\n> \n> But nothing really ever identifies the source repository (on a \"git \n> level\") for a push: as far as git is concerned, all repositories are \n> equal, and your hooks would invariably have to use non-git knowledge to \n> figure out whether some operation should be allowed or not.\nPerhaps it would be more git-like to use branches here. An accidental \nmerge from a branch to another is probably less likely than an \naccidental push.\n\nThanks, and best regards\n\nChristoph\n"}]}