Does Git only use the remote name "origin" for a repository which was created by cloning?
For example, say I create a repository, placed it on a remote, and try to clone it again into the same directory, which one would Git name origin?
2010: origin
is the default name used by git clone
, but you can use any other name when cloning:
--origin <name>
-o <name>
Instead of using the remote name
origin
to keep track of the upstream repository, use<name>
.
If you don't, any time you clone a repo, that remote repo will be referenced by the default name origin
.
With Git 2.30 (Q1 2021, 11 years later), you now have the option clone.defaultRemoteName
.
If origin
doesn't fit you, you can always rename it to a more appropriate name:
git remote rename <old> <new>
See description of git remote.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With