我们正在学习Git并希望只推送到我们的主要Git服务器(git.example.com)。其中必须部署(基于回购)到其他服务器,如我们的开发网络服务器(dev.example.com)和Redmine(redmine.example.com)项目管理服务器。Git推送到一个部署到多个其他远程存储库的远程回购站
据我们了解,这可以通过一个小的配置来完成:.git/config
在工作站上,如:
[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
我们对上述方案的意见。首先会消耗额外的带宽/上传。其次,我们不喜欢这必须在客户端配置:.git/config
。无论如何,至少在git.example.com上配置这个?
对于任何有同样问题的人,本网站确实帮了我们很多:Website maintenance with git, the pro way。小片断,你可以找到关于该页面的底部:
根据您的需求,您可能需要调整此过程 位。假设您只想从git.example.com上的裸仓库中将更改推送到暂存服务器 ,而不是直接从您的家庭 计算机上。您可以通过更改remote.staging.push 配置选项来读取
refs/remotes/origin/master:refs/heads/master
而不是refs/heads/master:refs/heads/master
。如果您有多个需要能够推送到登台服务器的开发人员,这可能会很有用。
我们并不完全理解这种可能的解决方案。但听起来它可能是我们问题的解决方案。我们也在阅读Git文档,并会让你们发布。
任何帮助真的很感激。提前致谢。