How can I do `git push` simultaneously with two different remotes?

My question is best answered by discussing various approaches to maintaining a pair of remote repositories in tandem to a certain point, after which "normal divergence" is assumed. Until now, I would like to click on both the Lakers and the Celtics from one reputable source.

Is there one simple syntax that would simplify this with every commit, or deserve its own procedure file? Will this application be for the hook, and if so, how can I build and manage it (the level of detail is up to you, I'm just looking for the keys).

I would like to accept the concept of changes when each of the remotes makes authentication changes that can affect me, for example, because my account is changing, and they accidentally created another key with the intention of informing me by email, but post the account changes in the first message and postpone the key change message until I have already pressed. In simpler terms, how does the fact that the control panel is administered by others complicate my plan to keep the original design identical?

I do not want to create too many distractions, so each of you can contribute to how much of my question that you feel will not take too much time.

+4
source share
2 answers

As explained in the pull / push response from several remote locations , you can configure several url parameters for the remote:

 [remote "origin"] url = git@github.com :Lakers/Lakers.git url = git@github.com :Celtics/Celtics.git 

You can set this in git config --local --edit file with git config --local --edit

Then you can do

 git push origin master 

Click on both repositories.

+6
source

I don't think git push provides syntax for simultaneously pushing two different remote controls. However, writing a bash script is trivial for this. I think you can also write a hook on one remote control (provided that you have access), which automatically switches to another remote control. I have not played with hooks yet, so I do not know abotu details how to do this.

+1
source

Source: https://habr.com/ru/post/1487372/


All Articles