We are learning Git and would like to push only to our main Git server (git.example.com). Which must deploy (based on the repo) to other servers like our development webserver (dev.example.com) and Redmine (redmine.example.com) project management server.
We understand that this can be done by a small configuration in: .git/config
on the workstations like:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = https://git.example.com/testing.git
# Development server only needs to serve the files.
url = https://dev.example.com/testing.git
# Redmine must be a bare one.
url = https://redmine.example.com/testing.git
Our opinion about above solution. First of all that would consume additional bandwidth/upload. Second we don't like that this must be configured on the client side: .git/config
. Is there anyway to configure this at least on git.example.com?
For anybody who has the same question this site did help us a lot: Website maintenance with git, the pro way. Small snippet which you can find on the bottom of that page:
Depending on your needs, you might want to adjust this procedure a bit. Let's say you only want to push changes to the staging server from the bare repository on git.example.com, not from your home computer directly. You can do this by altering the remote.staging.push configuration option to read
refs/remotes/origin/master:refs/heads/master
instead ofrefs/heads/master:refs/heads/master
. This might be useful if you have multiple developers who need to be able to push to the staging server.
We don't completely understand this possible solution. But sounds that it could be a solution for our problem. We are also reading through the Git documentation and will keep you guys posted.
Any help is really appreciated. Thanks in advance.