Introduction to Remote Repositories

What's a remote repository? How is it different from a local repository?

Transcript
Introduction to Remote Repositories

In this video, you’ll learn what remote repositories are - and what they’re used for.

About 90% of version control happens in the local repository, on a developer’s machine. Making changes, staging and committing them, inspecting the commit history, and so on.

Only when it comes to sharing data with your teammates, a remote repository comes into play. Think of it like a “file server” that you use to exchange data with your colleagues.

You can upload your own changes by pushing them to the remote repository. And you can download new changes by using the Fetch and Pull commands.

Until now in this course, we’ve only used a single remote command so far. That was when we “cloned” a copy of an existing remote repository.

Of course, your teammates will do all of this, too: they will publish their changes by pushing them to the common remote; and they’ll download changes by fetching and pulling.

Let’s look at the few things that distinguish local and remote repositories.

First, there’s the 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.

Technically, a remote repository doesn’t differ from a local one: it’s the same kind of Git repository; it contains branches, commits, and tags just like a local repo. However, a local repository has an additional working copy: a directory where some version of your project’s files is checked out.

A remote repository doesn’t have such a working directory: it only consists of the bare “.git” repository folder.

This also explains what both types of repositories are used for. Local repositories are used for working on a project - and with a project’s files. It’s where 90% of your daily actions happen - from making changes, to staging and committing them.

Remote repositories are there to share your work with your teammates. You’ll never directly perform a “commit” in a remote repository. You will only transfer existing commits to and from it.

So much for the theory behind remote repositories. In the next videos, we’ll look at how to work with them. Thanks for watching!