What does Git exactly do when we add an origin?
Is it like saying we are creating a new repository? How different it is from push?
What does Git exactly do when we add an origin?
Is it like saying we are creating a new repository? How different it is from push?
Traditionally, origin is just the default name assigned to a remote repository when you clone it:
git clone [email protected]:some/repo.git
will result in having
origin [email protected]:some/repo.git (fetch)
origin [email protected]:some/repo.git (push)
as the output of git remote -v.
Alternatively, if you want to be able to push/pull to/from another remote repository, you can do:
git remote add [email protected]:another/repo.git whatever
and receive
origin [email protected]:some/repo.git (fetch)
origin [email protected]:some/repo.git (push)
whatever [email protected]:another/repo.git (fetch)
whatever [email protected]:another/repo.git (push)
from git remote -v.
After that you'll be able to do both git push origin master and git push whatever master.