For each remote repository, you can ask pushurl, i.e., urlwhich will be subject to command changes push♪this one. pushurlby the way, maybe not a match. url this repository, that's the trick: pushI think it's a repository. bitbucket- and the changes go. github♪moreover: pushurl- there may be more than one, and change of one team will be on multiple occasions. url- Mm.Added pushurl with a team of approximately this:$ git remote set-url --add --push имя-репозитория url-репозитория
From theory to practice.create three (for sure) bare repository:$ for i in 1 2 3; do git init --bare repo$i; done
Initialized empty Git repository in ./repo1/
Initialized empty Git repository in ./repo2/
Initialized empty Git repository in ./repo3/
And make the clone of the first one:$ git clone repo1 work
Cloning into 'work'...
warning: You appear to have cloned an empty repository.
done.
$ cd work
Let's see the default configuration remote-So:$ git config --get-regexp "^remote"
remote.origin.url ../repo1
remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
And now we'll add pushurl- for all bare repositories established, without forgetting the original repository itself.../repo1$ for i in 1 2 3; do git remote set-url --add --push origin ../repo$i; done
$ git config --get-regexp "^remote"
remote.origin.url ../repo1
remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
remote.origin.pushurl ../repo1
remote.origin.pushurl ../repo2
remote.origin.pushurl ../repo3
As you can see, pushurl- You're positively added.Let's make a comemite and send it to the team. push:$ date > file
$ git add file
$ git commit -m 1
[master (root-commit) 2d68407] 1
1 file changed, 1 insertion(+)
create mode 100644 file
$ git push
Counting objects: 3, done.
Writing objects: 100% (3/3), 228 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../repo1
* [new branch] master -> master
Counting objects: 3, done.
Writing objects: 100% (3/3), 228 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../repo2
* [new branch] master -> master
Counting objects: 3, done.
Writing objects: 100% (3/3), 228 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../repo3
* [new branch] master -> master
The committ went to all three bare repository by one team!What about the other branches?Let's make another branch.newWe'll add a committ and send a change:$ git checkout -b new
Switched to a new branch 'new'
$ date >> file
$ git commit -am 2
[new c82bfe5] 2
1 file changed, 1 insertion(+)
$ git push -u origin new
Counting objects: 3, done.
Writing objects: 100% (3/3), 264 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../repo1
* [new branch] new -> new
Branch new set up to track remote branch new from origin.
Counting objects: 3, done.
Writing objects: 100% (3/3), 264 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../repo2
* [new branch] new -> new
Branch new set up to track remote branch new from origin.
Counting objects: 3, done.
Writing objects: 100% (3/3), 264 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../repo3
* [new branch] new -> new
Branch new set up to track remote branch new from origin.
This magia works with new branches! new All three bare repositories.response based on information https://stackoverflow.com/a/14290145/4827341 and https://stackoverflow.com/a/3195446/4827341 Answers.