About Remote Repositories
About 90% of version control related work happens in the local repository: staging, committing, viewing the status or the log/history, etc. Moreover, if you're the only person working on your project, chances are you'll never need to set up a remote repository.
Only when it comes to sharing data with your teammates, a remote repo comes into play. Think of it like a "file server" that you use to exchange data with your colleagues.
Let's look at the few things that distinguish local and remote repositories from each other:
Location
Local repositories reside on the computers of team members. In contrast, remote repositories are hosted on a server that is accessible for all team members - most likely on the internet or on a local network.
Features
Technically, a remote repository doesn't differ from a local one: it contains branches, commits, and tags just like a local repository. However, a local repository has a working copy associated with it: a directory where some version of your project's files is checked out for you to work with.
A remote repository doesn't have such a working directory: it only consists of the bare ".git" repository folder.
Usage
It's important to stress that the actual work on your project happens only in your local repository: all modifications have to be made & committed locally.
Then, those changes can be uploaded to a remote repository in order to share them with your team. Remote repositories are only thought as a means for sharing and exchanging code between developers - not for actually working on files.
Creation
You have two options to get a local repository onto your machine: you can either create a new, empty one or clone it from an existing remote repository.
Creating a remote repository can also be done in two ways: if you already have a local repository that you want to base it on, you can clone this local one with the "--bare" option. In case you want to create a blank remote repository, use "git init", also with the "--bare" option.
Local / Remote Workflow
In Git, there are only a mere handful of commands that interact with a remote repository.
The overwhelming majority of work happens in the local repository. Until this point (except when we called "git clone"), we've worked exclusively with our local Git repository and never left our local computer. We were not dependent on any internet or network connection but instead worked completely offline.
We'll look at each of these commands in the course of the following sections.