Back
GitoryxGitoryx
Beginner8 min read

Git Remote: Connect Your Repo to a Remote Server

A Git remote is a reference to a copy of your repository hosted elsewhere — GitHub, GitLab, Bitbucket, or your own server. This guide explains how to add, inspect, rename, and remove remotes, and how remote tracking branches work.

The Problem

You've initialized a local repository and written some commits, but you have no idea how to connect it to GitHub or push your work anywhere. Or you're trying to pull from a second remote and Git says it doesn't know where to look.

Remotes are the bridges between your local repository and the rest of the world. Understanding how to add, list, and manage them is essential for any collaborative workflow — whether you're pushing to GitHub, pulling from an upstream fork, or working with multiple team servers.

Common mistakes developers make with this:

  • Forgetting to add a remote after `git init`, then being unable to push
  • Confusing `origin` (your fork) with `upstream` (the original project)
  • Pushing to the wrong remote by accident
  • Not knowing that remote tracking branches like `origin/main` are just local snapshots

Gitoryx: Gitoryx lists all your remotes in the sidebar, shows their tracking branches in the commit graph, and lets you fetch, pull, or push to any remote in one click.

What is Remote: Connect Your Repo to a Remote Server?

A Git remote is a named reference to a repository hosted somewhere else — GitHub, GitLab, Bitbucket, or any server. The most common remote is `origin`, which Git creates automatically when you clone a repository.

Step-by-Step Guide

1

List existing remotes

Start by checking what remotes are already configured in your repo.

bash
git remote -v

# origin  git@github.com:user/my-project.git (fetch)
# origin  git@github.com:user/my-project.git (push)

If you cloned the repo, `origin` is already set. If you ran `git init`, there are no remotes yet.

2

Add a remote

Connect your local repo to a remote repository. `origin` is the conventional name for your primary remote.

bash
git remote add origin git@github.com:user/my-project.git

# Verify:
git remote -v
3

Add a second remote (upstream)

When working with a forked project, add the original repository as `upstream` so you can pull in updates from it.

bash
git remote add upstream git@github.com:original-owner/my-project.git

# Fetch the upstream branches:
git fetch upstream
4

Rename a remote

If you need to rename an existing remote (e.g., from `origin` to `github`):

bash
git remote rename origin github
See this workflow in Gitoryx — Gitoryx screenshot

See this workflow in Gitoryx. Remotes and their branches appear directly in the commit graph

Free download
5

Remove a remote

Remove a remote that is no longer needed. This only deletes the reference — it doesn't delete anything on the remote server.

bash
git remote remove upstream
6

Change a remote URL

If a repository moves, or you want to switch from HTTPS to SSH:

bash
git remote set-url origin git@github.com:user/new-location.git

# Verify the change:
git remote -v

Common Mistakes to Avoid

Mixing up origin and upstream

When working on a fork, `origin` is your copy, `upstream` is the original. Pushing to upstream (if you don't have write access) fails; pulling from origin instead of upstream misses new changes from the source project.

Fix: Always confirm with `git remote -v` before pushing or pulling.

Not fetching before checking remote tracking branches

`origin/main` is a local snapshot of the remote branch. It only updates when you fetch.

Fix: Run `git fetch origin` to update all remote tracking branches before comparing or merging.

Forgetting to set upstream when pushing a new branch

Git says 'The current branch has no upstream branch' when you try to push a branch for the first time.

Fix: Use `git push -u origin <branch>` the first time. The `-u` flag sets the tracking relationship.

Gitoryx — visual Git client for macOS, Windows & Linux
GitoryxGitoryx — macOS, Windows & Linux

Manage all your remotes visually in Gitoryx

  • Remotes and their branches appear directly in the commit graph
  • Add, rename, or remove remotes from the sidebar — no CLI needed
  • Fetch all remotes at once with a single click
  • See at a glance if your branch is ahead or behind origin
Download Gitoryx — FreemacOS · Windows · Linux · No subscription

Frequently Asked Questions

What is `origin` in Git?

`origin` is the default name Git gives to the remote from which you cloned. It's just a shorthand alias for the full remote URL. You can rename it or have multiple remotes with different names.

What is the difference between `git fetch` and `git pull`?

`git fetch` downloads new data from the remote and updates remote tracking branches (like `origin/main`) but does not change your local branch. `git pull` does a fetch followed by a merge (or rebase) into your current branch.

Can I have multiple remotes?

Yes. You can add as many remotes as you need. Common setups include `origin` (your fork) and `upstream` (the original project), or multiple deployment targets.

How do I push to a remote for the first time?

Use `git push -u origin <branch-name>`. The `-u` flag sets the tracking relationship so future `git push` and `git pull` commands know which remote branch to use.

See it in action with Gitoryx

Everything in this tutorial is faster and clearer with a visual Git client. Gitoryx is free, runs natively on macOS, Windows, and Linux, and built for developers who want to move fast without breaking things.