0

We have a repository at work which needs to be pushed to two different remotes. There's one remote on our primary network (which we all use for daily internet access, local networking, etc.) and another remote on a different, separate network.

In our normal workflow, we make all pushes to the repository (hosted on Stash) on our primary network. But sometimes, we need to update the repo on the secondary network. The way that this currently works is that we pull down the repo, add a remote for the secondary network push, and then push to that.

What I'd like is to not have to add a remote to the repo each time we do this. I'd like to do something like git remote add secondary <url> and then run some kind of push command so that the next time I pull the repository down, it knows about the remote named secondary. Currently, when we do a fresh clone, git remote -v only shows origin, pointing at the url the repo was cloned from.

I've spent some time trying to track this down but haven't had any luck. Is there some way that I can push the list of remotes up to Stash (on our primary network) so that I have my secondary remote as soon as I clone my repo?

1 Answers1

0

No, the list of remotes is not versioned and not something you can push or fetch.

What you could do is create a script inside your repo that recreates your remotes. That way after someone clones, they can run that script, and then push as needed

Saeed
  • 287
  • 2
  • 7