What is a remote repository and why it exists
Published on 2026-09-12 by frfrand
A remote is not "the cloud": it is another copy of the repository with a name. What fetch, pull and push do, and why it is convenient to separate fetching from integrating.

Short answer: a remote repository is another copy of the same repository, elsewhere, to which you gave a short name like origin. git fetch brings in what's new without touching your work, git merge integrates it, and git pull does both at once. Separating fetching from integrating avoids most surprises.
A remote repository sounds like "the repository in the cloud". It's a convenient and misleading description.
A remote is simply another copy of the repository, elsewhere, to which you gave a short name so you don't have to type the address every time.
$ git remote -v origin git@github.com:empresa/app.git (fetch) origin git@github.com:empresa/app.git (push)
"origin" is nothing special. It's the default name of the first one you configure. It could be called "github", "central" or "pepe".
Why it's needed if Git is distributed
Technically it isn't. Two people could pull directly from each other's machines. Git supports it.
In practice it doesn't work: computers turn off, change networks, are behind routers. So the team agrees on a place that's always available, and that place becomes the meeting point.
The difference with old centralized systems is subtle but important: that server is a convention, not a technical necessity. Its copy is no more "true" than yours; it's just always on.
Three commands, and one that confuses
git fetch downloads what's new on the remote and stores it separately, in references such as origin/main. It does not touch your files or your branch. It is always safe to run, and it is the correct answer to "what's new?".
git merge origin/main integrates that into your current branch. This is where conflicts can appear.
git pull does both, one after the other.
That merging of steps is the cause of a very common feeling: that conflicts "appear out of nowhere". They don't appear out of nowhere; what happens is that pull did two things and you only saw the second one.
A habit worth having, especially in active teams:
git fetch git log --oneline HEAD..origin/main # what came in git merge origin/main # now yes
Three commands instead of one, and no surprises.
push, and why it is sometimes rejected
git push sends your commits to the remote. The remote accepts it only if your history contains theirs: that is, if you can advance without losing anything.
If someone uploaded something you don't have, the push is rejected. It is not an error: it is a protection. If it were accepted, that person's commits would be orphaned.
The correct solution is to bring in what's new, integrate it, and push again.
And the incorrect solution, which appears in many answers on the Internet:
git push --force
That replaces the remote history with yours, and the other person's work disappears from the remote. If forcing is really necessary (for example, after rewriting your own branch), there is a much safer variant:
git push --force-with-lease
That fails if the remote changed since the last time you checked it, instead of blindly overwriting.
Multiple remotes at once
Nothing forces you to have just one:
git remote add upstream git@github.com:original/proyecto.git git fetch upstream
This is the classic flow when working on a fork: origin is your copy, upstream is the original project, and you pull from one and push to the other.
You can also have a remote that is your own server, and deploy with a direct push.
A short recommendation
Configure the remote via SSH and not via HTTPS. With SSH you use your key, you don't write passwords or tokens, and it works the same on your machine and on an integration server.
If you already have it via HTTPS:
git remote set-url origin git@github.com:empresa/app.git
A remote repository is not automatically production
You can have the latest version of your code on GitHub without having updated the public application. The remote repository is used to share and review changes; deployment is another process, which builds and runs a specific version.
With ArduMaker you can link a GitHub repository to a VPS and define how to deploy the project. It is advisable to record the source branch, the published commit, the environment variables, and the deployment result. Do not store passwords or private production files in the repository.
To continue: From git push to production · What is GitHub Actions.
Frequently asked questions
What is the difference between git fetch and git pull? fetch downloads new changes and stores them separately (in references such as origin/main) without touching your branch. pull performs fetch and then integrates immediately, which is where conflicts can appear.
Why does the remote reject my push? Because someone pushed commits that you do not have. Fetch the new changes, integrate them, and push again. If you really need to force it, use git push --force-with-lease.
Is it better to configure the remote via SSH or HTTPS? Via SSH: you use your key, you do not type tokens, and it works the same on your machine and on a server.