The origin

With the git push -u origin Risotti command, we told Git to upload our Risotti branch (and the commits within it) to the origin; with the -u option, we set the local branches to track the remote one.

We know that origin is the default remote of a repository, just as master is the default branch name; when you clone a repository from a remote, that remote becomes your origin alias. When you tell Git to push or pull something, you often have to tell it the remote you want to use; using the alias origin, you say to Git you want to use your default remote.

If you want to see remotes actually configured in your repository, you can type a simple git remote command, followed by -v (--verbose) to get some more details:

[17] ~/Cookbook (master)
$ git remote -v
origin  https://github.com/fsantacroce/Cookbook.git (fetch)
origin  https://github.com/fsantacroce/Cookbook.git (push)
  

In the details, you will see the full URL of the remote and discover that Git stores two different URLs:

  • The Fetch URL, which is where we take updates from others
  • The Push URL, which is where we send out updates to others

This allows us to push and pull changes from different remotes, if you like, and underlines how Git can be considered a peer-to-peer versioning system.

You can add, update, and delete remotes using the git remote command.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.193.232