0

I'm trying to install a Git Server in a RedHat 6.5 box
I'm folowing this tutorials : 1,2,3, and to be honest the more I read the more things get obscure.

If I'm to create a git user wich will be the owner of the main repos and also in charge of doing the commits, how do I prevent a developer from pushing a bad code (gitolite, is there something neweer?)?
What is the simplest configuration for the git server( I would love gitlab but my boss will not alow that) while alowing the developer push only when the code has been reviewed, and granted permission to do the push.

note: All the developers have ssh access to the server. and I have collected theirs ssh.pub keys

  • there is much more things needed to be done than just prevention, good scm plan is key, not to mention predictions in grow of environment in future, also type of development is very important. – klerk May 9 '14 at 19:32
  • I can't imagine any reason why your boss would not go for gitlab. Its free, allows code reviews, and can stay behind a firewall. It is so much better than the simple git server. – spuder May 9 '14 at 22:37
  • I totally agree with you. I think the problem with Gitlab its all the resources it uses and my boss doesn't like that – JAT2007 May 13 '14 at 14:13
1

To answer your question:

If I'm to create a git user wich will be the owner of the main repos and also in charge of doing the commits, how do I prevent a developer from pushing a bad code?

The answer is not to create a git user. You can control access permissions to the remote repository with standard UNIX users and groups. Since git pushes work over SSH, as long as you can SSH to the server hosting the repository and you have read access to the repository via your account on the server, you can read, clone, and pull from repositories. If you have write permissions on the repo as well, you can push commits too.

  • 1
    well I finally just created a bare repo in the server and its available to every developer that has ssh access, still thinking about implementing another security layer on top of that(e.g. gitolite) just to avoid the direct commit on a particular branch. cause right now it only has the built in os permission security schema – JAT2007 May 13 '14 at 14:18
  • Sounds like you know what you're doing, then. – jayhendren May 13 '14 at 16:44
0

One of the things by default enabled in git is:

git push --force

In the normal cases you should always disable this in repo via:

git config --system receive.denyNonFastForwards true

problem can come with merge workflow scenario when you can have a lot of pull requests, but always the best solution is to have good merging and separated dev tasks where developers realy can understang git and not to commit that much (mostly because they dont understand nature of version control) and if that is ok you will have less conflicts. Good training and understaning is always the best. Also you can prevent this with the rebasing commits localy. The second alternative is Github maybe. In that scenario, you don't let more than one maintainer push to the important branches on the authoritative repository

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.