0

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?

Community
  • 1
  • 1
JHowIX
  • 1,683
  • 1
  • 20
  • 38
  • Instead of editing the config file manually, you can also do `git remote set-url --add origin repository2`. – poke Mar 03 '14 at 17:55

1 Answers1

1

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.

Abizern
  • 146,289
  • 39
  • 203
  • 257