Back to roadmap

Lesson 09

Remotes

A remote is a saved name for another repository that your local project can exchange history with.

Visual Explanation

Ready to run git remote add origin https://gitlab.com/acme/shop.git.

Keep These Ideas

Local repository
The commits stored on your computer.
Remote repository
A separate shared copy, often hosted on GitLab or GitHub.
origin
A conventional nickname for a remote, not a special server.

The Real Command

Terminal
git remote add origin https://gitlab.com/acme/shop.git

This saves the repository URL under the short name origin. It does not upload anything yet.

Command Details

git remote -v

-v means verbose. It lists remote names together with their fetch and push URLs.

Example Output
origin  https://gitlab.com/acme/shop.git (fetch)
origin  https://gitlab.com/acme/shop.git (push)
git remote get-url origin

get-url prints the saved address. Use it to verify where origin points.

Example Output
https://gitlab.com/acme/shop.git

Knowledge Check

Connect Local and Shared Repositories

Inspect remote addresses and understand what a remote name represents.

Question 1 of 5

  1. Question 1: current
  2. Question 2: not started
  3. Question 3: not started
  4. Question 4: not started
  5. Question 5: not started
Command Challenge

Save https://gitlab.com/acme/shop.git as a remote named origin.