Loading lessons...
Remote Repositories
Remote Repositories
A remote repository is a copy of your project stored online, on a service like GitHub, GitLab, or Bitbucket.
Why use a remote?
- Back up your code in the cloud.
- Share your project with others.
- Collaborate with a team.
- Deploy your project to servers.
Local vs remote
- Your local repository lives on your computer in the
.gitfolder. - The remote repository lives online.
git pushcopies local commits to the remote.git pullcopies remote commits to your local repo.
The origin name
The first remote you add is normally named origin by convention. When you clone a repository, Git sets up origin automatically.
Check your remotes
git remote -v
This shows your remote names and their URLs.
Add a remote
git remote add origin https://github.com/user/repo.git
This connects your local repository to an online one named origin.
TL;DR
- A remote is an online copy of your repository.
- Push sends local commits online; pull brings them back.
- The first remote is usually named origin.
git remote -vshows your remotes and URLs.