Frequently asked questions around Git and Version Control.
How to Add a Remote in Git
Cloning a repository from a remote server downloads the project to your local computer and leaves you with a local Git repository. This local Git repository will already have a connection to the original remote set up, automatically. This is what the "origin" remote connection points to.
But if you started by creating a local repository on your computer, there won't be such a connection. Let's look at how to add a remote in this short article!
The Git Cheat Sheet
No need to remember all those commands and parameters: get our popular "Git Cheat Sheet" - for free!
First, it's important to understand that origin is in no way a "special" name. In theory, you could name your remote connections any way you like. But the common, agreed-upon convention is to call a repository's main remote connection "origin" - which is why it makes sense to adhere to this naming scheme.
We're going to add a new remote connection to our local repository using the git remote command and need to pieces of information for this:
The name we'd like for this new remote.
The URL of the remote repository. You can find this after creating a new remote repo on your hosting service of choice (e.g. GitHub, GitLab, Bitbucket...).