git remote
Manage the bookmarks that point at other repositories.
git remoteWhat it does
git remote is a thin config manager: it lists, adds, renames and removes remote bookmarks. Each remote is just a name → URL mapping stored in .git/config. The commands git fetch, pull and push all read that mapping when you say 'origin'.
Your machine
local repository
Remote origin
everything.git
git remote wires origin in the config — the bookmark for the outside world
Watch it — press play
A narrated, step-by-step walkthrough that shows how to do it — not just theory. It adapts to the learner mode you picked in the top bar.
Step 1
Bookmark another repo
A remote is just a name → URL note. No network happens until you fetch or push.
git remote add origin git@github.com:user/repo.gitYour machine
local repository
Remote origin
everything.git
git remote add links a name to a URL
Under the hood
A remote is two lines of config
git remote add origin <url> writes a section into .git/config. Nothing is transferred, no network happens — it's a bookmark.
[remote "origin"] url = git@github.com:user/repo.git fetch = +refs/heads/*:refs/remotes/origin/*
Fetch lines become remote-tracking refs
The fetch refspec says 'take remote heads and store them locally under refs/remotes/origin/'. That's why `git fetch` later creates local read-only copies of every remote branch.
Aliases the pros type
Memorize the git remote concept, then let one of these shortcuts make it instant. Aliases are real git config keys — add one with:
git config --global alias.st # → git remoteg rmgit remoteList remote bookmarks.
g rmvgit remote -vList WITH their URLs — the honest view.
g rmagit remote add upstream <url>The fork-flow standard: add upstream.
Command anatomy
addBookmark a new repository.
-vList remotes with their fetch/push URLs.
removeDelete a bookmark (doesn't touch the remote repo).
renameChange a remote's name.
set-urlRepoint a remote's URL (e.g. HTTPS → SSH).
When to reach for it
Forking workflow: add an upstream remote pointing at the original repo.
Switching from HTTPS to SSH auth: git remote set-url origin git@….
Checking where 'origin' actually lives before pushing somewhere sensitive.
Pro tip
The fork workflow lives on remotes: `origin` = yours, `upstream` = the original. Keep both, fetch upstream, merge upstream/main into your feature, and the project's maintainers can merge your PR cleanly.