0

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?

2

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.