preventing a push
Is there a (recommended?) way to prevent accidental pushing (or pulling) from one repository into another (like the level command from bk days)?
Best regards
Christoph
Quoted 3 lines · Christoph Duelli
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
Quoted 6 lines · Linus Torvalds
Quoted 2 lines · Christoph Duelli
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?
Indeed, you can not move changes to a repo with a lower level.
Quoted 1 line
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.
Ok, I will give hooks a try here.
Quoted 3 lines
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.
Perhaps it would be more git-like to use branches here. An accidental merge from a branch to another is probably less likely than an accidental push.
Thanks, and best regards
Christoph