Home > Net >  Git remote renaming and different copies of cloned repository
Git remote renaming and different copies of cloned repository

Time:11-27

Background

I renamed a remote from origin to newname as a test on a private repository used for testing all kinds of git commands.

Originally when running git remote -v show there was origin shown as a default before the repository url.

After renaming with git remote rename origin newname, newname was shown as expected.

These commands were run on Windows 10.

Different remote names shown on different copies of repository

However when I cloned the same repository on WSL Ubuntu run on same computer, there was actually still origin shown with git remote -v show.

Question

Should remote name update for each different copy of the repository cloned or is the name spesific to only for same instance with which renaming was done (in this case the original Windows 10 cloned copy of the repository)?

CodePudding user response:

Remote name is a property of a given repo clone. It's not synced back to the shared repo, or otherwise communicated to any other clone of the same repo. It's not like a branch or any other ref, it's just part of a clone's local config.

There's no problem at all with different clones of the same repo having different names for it. Indeed, if everything was called "origin", you couldn't really have more than one remote in a single repo (which you absolutely can, although only one is the default upstream).

  •  Tags:  
  • git
  • Related