32. What is origin?

Goals

  • 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: /home/alex/githowto/repositories/work
  Push  URL: /home/alex/githowto/repositories/work
  HEAD branch: main
  Remote branches:
    main  tracked
    style tracked
  Local branch configured for 'git pull':
    main merges with remote main
  Local ref configured for 'git push':
    main pushes to main (up to date)

We can see that the origin of the remote repository is the original work 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).