Loading...

Git Tutorial

What is origin in git

Lets learn about the naming of the remote repositories.

RUN:

git remote

RESULT:

$ git remote
origin

We see that the cloned repository knows the default name of the remote repository. To get more information about origin:

RUN:

git remote show origin

RESULT:

$ git remote show origin
* remote origin
  Fetch URL: /Users/kwil3arn/Documents/Presentations/gitdemo/auto/hello
  Push  URL: /Users/kwikl3arn/Documents/Presentations/gitdemo/auto/hello
  HEAD branch (remote HEAD is ambiguous, may be one of the following):
    style
    master
  Remote branches:
    style  tracked
    master tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local ref configured for 'git push':
    master pushes to master (up to date)

We can see that the “origin” of the remote repository is the original hello repo. Remote repos are typically stored on a separate machine or a centralized server. However, as we see, they can also point to a repository on the same machine. There is nothing so special about the name “origin”, but there is a convention to use it for the primary centralized repository (if any).