提交对Git配置的更改 [英] Commit Changes to Git Configuration
问题描述
我有两个需要推送的权威git存储库.通过在.git/config文件中添加一行来完成对两者的推送:
[remote "origin"]
url = repository1
url = repository2
如从多个远程位置拉/推中所述. >
但是,每次团队的另一个成员进行新克隆时. .git/config文件返回到只有以下内容:
[remote "origin"]
url = repository1
是否可以提交"配置更改,以便默认情况下将存储库设置为推送到两个权威源?
这是因为.git/config
特定于本地存储库,而不与上游存储库共享.
如果需要执行此操作,则可以向同事展示如何为多个上游存储库配置他的存储库,或者更一般地说,在您的存储库中提供一个引导脚本来设置上游.如果此脚本位于主存储库文件夹中,则它将由git进行跟踪,并且可以与克隆存储库的其他人共享.
I have two authoritative git repositories that I need to push to. Pushing to both is done by adding a line to the .git/config file:
[remote "origin"]
url = repository1
url = repository2
as discussed in pull/push from multiple remote locations.
However every time another member of my team makes a new clone. The .git/config file goes back to only having:
[remote "origin"]
url = repository1
Is there a way to "commit" the configuration changes so that the repository is setup by default to push to both authoritative sources?
That's because .git/config
is specific to a local repository and not shared to upstream repositories.
If you need to do this, you could either show your colleague how to configure his repository for multiple upstream repositories, or even more generally, provide a bootstrap script in your repository to set up the upstreams. If this script is in the main repository folder, it will be tracked by git, and can be shared with others who clone the repository.
这篇关于提交对Git配置的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!