I use Git for managing my source code. I usually have 3 Git repositories, Local repository, Server repository and Production repository.
This is a development version of your project. Here you develop new feature and tests things.
This is a server repository. Any developer push to this repository and the production pulls from it.
This repository holds the production repository. You should not develop to this repository just pull the changes from Server repository.
Github is very great for hosting public projects and sharing codes. But what if you want to host it and don’t want to share codes publicly. Then you need to host your codes.
Hosting git repository is very easy. Here are the steps:
git clone --bare my_project my_project.git
scp -r my_project.git firstname.lastname@example.org:location/for/my_project.git
ssh email@example.com cd location/for/my_project.git git init --bare --shared
If you want to make the bare repository writable by specific group: Fix the folder permission and assign user to that group
chgrp -R group_name folder_name
git clone firstname.lastname@example.org:location/for/my_project.git
If you have a production code running on the server and a local code for development.
You will have 3 repositories:
The scenario for deployment would be:
The steps for the scenario:
git commit git push origin
git pull origin
Reference: Git on the Server