JERC
JERC

Reputation: 1624

GIT Dev/Testing/Production Environment Best Practices

I want to implement GIT on my apps, I have read some best practices about branching in projects (like this: http://nvie.com/posts/a-successful-git-branching-model/) and I am going to implement them.

But I have a Question about how to manage each environment by remotes origins, not just in branches, For Example:

git remote add staging Gitserver:/git/stage_repos/repo.git
git remote add production Gitserver:/git/production_repos/repo.git
git remote add dev Gitserver:/git/dev_repos/repo.git

git push staging staging-branch
git push production master
git push dev dev-branch

My Question is, if I have to create 3 BARE repositories on GitRemoteServer for each environments to push them, and after enter to the AppServer(in prod,dev or stage) and do the PULL?

Or

If there is a way to create a Remote Init Repository(Not Bare) in the real Stage and Production Environment when I can push my commits and immediately view the changes on them, without to enter the server and apply PULL?

Upvotes: 1

Views: 2794

Answers (1)

Wayne Werner
Wayne Werner

Reputation: 51897

You can create a post commit hook on the server and have it automagically copy all the data to your live directory.

You also might consider using some other tool, like Jenkins for continuous integration, to actually manage the deployment.

Upvotes: 1

Related Questions