Managing Remotes
Remote repositories are versions of your project hosted on the internet or network.
What is a Remote?
A remote is a bookmark to another repository. Common remotes:
origin- Your fork or main remoteupstream- Original repository (for forks)
Viewing Remotes
Remote Commands
| Command | Description |
|---|---|
git remote | List remote names |
git remote -v | List with URLs |
git remote add <name> <url> | Add remote |
git remote remove <name> | Remove remote |
git remote rename <old> <new> | Rename remote |
Adding a Remote
git remote add origin https://github.com/user/repo.git
For forks, add upstream:
git remote add upstream https://github.com/original/repo.git
Removing a Remote
git remote remove origin
Changing Remote URL
git remote set-url origin https://github.com/new/repo.git
Remote Branches
View remote branches:
git branch -r
View all branches (local and remote):
git branch -a
Fetching Remote Info
git fetch origin
git fetch --all # All remotes
Prune Stale Branches
Remove references to deleted remote branches:
git fetch --prune
# or
git remote prune origin
Exercise: View Remotes
Run git remote -v to see configured remotes:

