A remote (sometimes called “external”) repository is a version of your project stored on a remote server. The repository on such a server can be accessed over the Internet or over a local network.
A remote repository is a full-fledged repository, no different from a local repository. A remote repository has its own branches, its own HEAD pointer, its own commit history, and so on.
If we connect the remote repository to our local repository, we will have copies of all the reference objects in the remote repository. That is, for example, the remote repository has a main branch, and we will have a copy of this branch – origin/main. All such reference objects (pointers, branches and tags) of the remote repository are stored almost in the same place as the local one – in the directory .git/refs/remotes/.
It is common to name remote branches (that is, branches of remote repositories) by appending the name of the remote repository to their name. For example, if we have a remote repository with the name origin and the branch main, we would call that branch origin/main. We will do the same with all other reference objects. This may seem redundant, but it actually adds definition and prevents you from getting confused by multiple branch names.
One of the advantages of a distributed version control system is that you can have as many remote repositories as you want. Some of them can be read-only, and some of them can be read-write.
Thus, to become a full-fledged Git user, it is important to learn the skills needed to work with a remote repository. These include creating new and copying existing remote repositories to yourself, uploading local commits to the server, and downloading changes from the server.