39. What is origin?

Goals

  • To 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/alex/Documents/Presentations/githowto/auto/hello
  Push  URL: /Users/alex/Documents/Presentations/githowto/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).