Working with GitHub: remotes, push and pull

Harry · 14 Sep 2026 · 2 views
Advertisement
Advertisement

What a remote is

A remote is a copy of your repository hosted elsewhere – usually on GitHub. It is where you back up your history and share it with others. The default remote is conventionally named origin.

Two ways to start

Clone an existing project:

git clone https://github.com/user/repo.git

Publish a local repo: create an empty repository on GitHub, then connect and push:

git remote add origin https://github.com/you/myproject.git
git push -u origin main

The -u flag sets origin/main as the upstream for your main branch, so future pushes and pulls need no arguments.

The daily sync

git push        # send your commits to GitHub
git pull        # fetch others' commits AND merge them in
git fetch       # download changes WITHOUT merging (inspect first)

pull is really fetch followed by merge. When you want to see what changed before integrating, run fetch, review, then merge.

Authentication

GitHub no longer accepts your account password on the command line. Use a personal access token in place of the password over HTTPS, or set up an SSH key and use the SSH remote URL. SSH is the smoother long-term choice for regular contributors.

Key points

  • A remote (usually origin) is your hosted copy on GitHub.
  • clone copies an existing repo; remote add + push -u publishes a local one.
  • push sends commits, pull fetches and merges, fetch downloads without merging.
  • Authenticate with a personal access token or an SSH key, not your password.
Share this post:

Comments (0)

Please login or register to comment.