Overview: Managing Git Remote Repositories
This post is about managing remote repositories in Git. We explore tasks such as adding, renaming, removing remotes, and updating remote URLs. We also practice fetching, pulling, and pushing changes to and from remote repositories.
What Are Git Remotes? Definition and Purpose
A Git remote is a named reference to a version of your repository hosted on another computer or platform such as GitHub or Bitbucket. Git remotes connect your local project to those copies, letting you back up, share, and synchronise your code across machines.
Are Git Remotes similar to Git branches? Remotes are not branches, but they work together. Branches are like alternate timelines within your repository, while remotes are links to entirely different repositories (potentially with their own sets of branches). You can have branches on your local and remote repositories, and Git helps keep them in sync.
Git Remote Commands Reference
The most useful commands for working with Git Remotes are (see Git Basics - Working with Remotes):
git remote add <name> <url>: Adds a new remote.
git remote show <name>: Inspects a remote.
git remote -v: Shows your remotes and their URLs.
git fetch <name>: Gets updates from the remote without merging.
git pull <name> <branch>: Downloads and merges remote changes.
git push <name> <branch>: Uploads your local changes to the remote.
git remote rename <old-name> <new-name>: Renames a remote.
git remote remove <name>: Removes a remote.
git remote set-url <name> <new-url>: Updates a remote’s URL.
The fix for the origin error, best practices for solo and team work, and token authentication follow below.
Using Git Remotes: Best Practices
🔒 Subscribe to keep reading.
Using Personal Access Tokens for Git Authentication
🔒 Subscribe to keep reading.
Conclusion
🔒 Subscribe to keep reading.
References
🔒 Subscribe to keep reading.
You've hit a Deep Dive tutorial.
I spend dozens of hours researching, coding, and breaking things to write these guides. This content is free, but reserved for my subscriber community. Drop your email below to unlock this guide (and all past/future deep dives):
Full content temporarily unavailable — refresh in a moment
Already a subscriber? Use the magic link from your last newsletter, or reset your password.
Log in to unlock
New subscribers get an inbox mail: Set a password to unlock articles. The form does not log you in — use the same email afterwards.