josh_eime
josh_eime

Reputation: 125

Is one git remote aware of another?

I have a local repository, to which I have associated two remotes (via git remote add...). I regularly push to both remotes. Are the two remotes linked or aware of each other in any way?

In case it's relevant, I'm trying to design a homework "competition" for multiple people to work on without being aware of the others' work.

Upvotes: 3

Views: 407

Answers (4)

triplem
triplem

Reputation: 1334

The two remote are "links" on your own repository but do not know anything about each other.

So if you are working on your own repo and push your changes to one of the remote, the other remote does not know about these changes until you push them to this one as well.

Git is a distributed system and remote are just normal repositories on other ones machine (well, if they are bare then they are not usual repositories but still repositories). The remotes do not know about your local repository so they dont know about your other remotes as well.

Upvotes: 3

Code-Apprentice
Code-Apprentice

Reputation: 83517

Each repo has its own remotes. The only way one repo can be aware of another is if you add the second repo as a remote to the first. This is a one-way relationship. If repo A is a remote of repo B, then B does not automatically know anything about A.

Upvotes: 2

user229044
user229044

Reputation: 239240

No, they're not. You can have an arbitrary number of remotes, and none of them are inherently made aware of each other because of this.

Upvotes: 5

Mureinik
Mureinik

Reputation: 311063

Adding to repos as remotes of the same local repo does not make them aware of each other. So unless you've added one as a remote on the other remote, there's no relationship between them.

Upvotes: 1

Related Questions