Git Remotes
Published Sep 27, 2023Updated Sep 27, 2023
Contribute to Docs
Git remotes are copies of repositories that are not stored locally. Working with a remote often involves two copies or references:
- The forked repository (repo): By convention, these are named the
originremote which refers to the default repo. - The base or home repo: The
upstreamremote refers to the remote repo that is being tracked for changes and contributions.
Syntax
Remotes can be set with the git remote add command:
git remote add remotename remoteURL
Adding Remotes Using Docs
To manually set up the remotes, the forked repository would be named the origin remote:
git remote add origin https://github.com/yourusername/docs.git
The base Codecademy/docs repo would be named the upstream remote:
git remote add upstream https://github.com/Codecademy/docs.git
Note: If the repository is cloned onto the computer, the remote defaults to
origin. Additional set up would only be needed for theupstreamremote.
Run the git remote -v (v flag is for verbose) command to check the list of remotes:
git remote -vupstream https://github.com/Codecademy/docs.git (fetch)upstream https://github.com/Codecademy/docs.git (pull)
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn Git on Codecademy
- Use our beginner friendly Git course to integrate Git and GitHub and manage versions of your projects using Git branches.
- With Certificate
- Beginner Friendly.4 hours
- Learn about the command line, starting with navigating and manipulating the file system, and ending with redirection and configuring the environment.
- With Certificate
- Beginner Friendly.4 hours