Intermediate · 8 min · practise every command in the built-in terminal

Working with Remotes

A remote is a version of your repository hosted elsewhere (GitHub, GitLab, a server).

Clone an existing repository

git clone https://github.com/user/repo.git
git clone https://github.com/user/repo.git my-folder

Connect a local repo to a remote

git remote add origin https://github.com/user/repo.git
git remote -v            # List configured remotes

Send commits to the remote

git push origin main
git push -u origin main   # -u remembers this pairing for future plain `git push`

Fetch and merge from the remote

git pull origin main      # fetch + merge in one step
git fetch origin          # Just download, don't merge yet

Typical daily workflow

git pull                       # Get latest changes
# ...make edits...
git add .
git commit -m "Add feature X"
git push

Practice tasks

  1. Add a remote named 'origin' pointing to a repository URL
  2. Push your commits to the 'origin' remote on branch 'main'
  3. List your configured remotes with their URLs
  4. Pull the latest changes from origin

Commands in this lesson

Git & Version Control