2

I’d like to set up my git server so that any pushes to, say, master are turned into pushes to master-unchecked; obviously to then run something server-side that verifies that the changes are ok, before moving them to master (bypassing the diversion locally).

Is that possible using, some of the git server management tools like gitolite, gitosis or gitano?

Note that I’d like to avoid the developers to manually have to run git push origin master:master-unchecked.

bad_coder
  • 11,289
  • 20
  • 44
  • 72
Joachim Breitner
  • 25,395
  • 6
  • 78
  • 139

1 Answers1

0

This is generally best managed with an intermediate repository.
That way, you don't have any question to ask regarding the destination branch: it is master anyway.

A post-receive hook can then test, and if the test is successful, push to the final target repo.

Note: gitolite (leaving aside gitosis, which is dead since 2010) is an authorization layer, not a workflow manager. It isn't needed for the intermediate repo.
It can be needed for the final repo in order to prevent any push.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • But then the developers would likely start pulling from that repository’s master, defeating the purpose, wouldn’t it? I don’t think “pull from this repo and push to that repo” would work any better than “pull from this branch and push to that branch”. – Joachim Breitner Jan 26 '14 at 11:52
  • 1
    @JoachimBreitner no, you can set a remote for push only, while setting the pull from the final repo. A gitolite on the final repo can, if you want, prevent any push to the final repo. – VonC Jan 26 '14 at 12:16
  • @JoachimBreitner it is the "guarded commit" approach I already mentioned in http://stackoverflow.com/a/21155289/6309. – VonC Jan 26 '14 at 12:20
  • “you can set a remote for push only” – can I really do that? Or will every developer have to do that? I’d really like something transparent as possible here. – Joachim Breitner Jan 26 '14 at 12:44
  • @JoachimBreitner yes, override the push part of a remote as in here: http://stackoverflow.com/a/7556269/6309 (it was for fetch only, but the idea can be reversed). That being said, for a transparent setup, I would keep the current destination repo, add a gitolite to prevent any pull, and add a hook in order to make the test and push to a new final repo. If the users want to pull, they will *have to* add a new remote. – VonC Jan 26 '14 at 12:55