Domanda

Until end of year 2012 I was one of those horrible webdevelopers that duplicate and renamed files on a live server to filename_dev.php before editing. When a feature was tested, I renamed it back.

Begin 2013 I became fan of GIT and from that point I forbid myself to start new projects without GIT.

My goal is to run my own private git server with the following capabilities:

  • Multi user access
  • Master branch is a live running website.
  • Dev branch is also live, but only for the developers to check if there code is running fine.
  • Only I have access to the master branch to bring new features from other branches live.
  • Developers can't see password settings like MySQL.

On my CentOS VPS server I created a new user "git" and give it a password. To avoid sharing that password to multiple users, I setup a public key structure. So a new developer send me his public key and I add it to /home/git/.ssh/authorized_keys

Well ok, let say I want to start a new project with 4 developers on it. I create a new repo /home/git/project_1.git and add all there public keys to the authorized file.

How can I avoid them accessing another repo like "/home/git/project_2.git" ?

Since git is just a user on my vps, it isn't a hosted apache directory, so how can my developers check there code in the browser? Like http://dev.mydomain.com

When the code on http://dev.mydomain.com is running fine, I like to push it live to http://mydomain.com. But only I can do that, not the developers

Hopefully I was on the right track this week, but my GIT ebooks are not that detailed to get any clue how to do this

È stato utile?

Soluzione

First, you should look into gitolite: it allows to manage users and access to repositories.

With gitolite you can restrict what repositories and branches user has access to. For dev branch you may want to set up a git post-receive hook script: so your git repo will SSH to dev server and pull code from the repository.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top