Home > other >  Push from local repo to origin. Origin being another local copy of repo on different machine
Push from local repo to origin. Origin being another local copy of repo on different machine

Time:07-31

In what might be a typical scenario, your repo is hosted on a remote server. Your remote code may then be tracked by a local client.

In this scenario, I'm curious to know if the local client can itself act as a serving entity to another local client?

And can you chain that so that several clients are involved?

So in this chain

  • LocalA > push > LocalB > push > Remote

This relationship would be defined as

  • LocalA(client) > LocalB(server)

And this relationship would be defined as

  • LocalB(client) > Remote(server)

CodePudding user response:

When you push from Repo A to Repo B, Repo A is acting as a client and B as a server.

When you fetch from Repo A to Repo B, Repo A is acting as a server and B as a client.

Specially, when you fetch/push from Repo A to Repo A itself, Repo A is acting as both a client and a server. For example, in Repo A, you can run git push . HEAD:new_branch or git fetch . HEAD:new_branch. Both create a new branch from HEAD.

Repo A and Repo B can be on the same machine, or on different machines, as long as one can access to the other.

  •  Tags:  
  • git
  • Related