Remotes: git push, pull, fetch & clone
Remote repositories are hosting points (like GitHub or GitLab) used to back up commits, trace histories, and sync modifications across developer teams.
1 Remote Operations
Shell — Remote Management
# Show linked remote tracking URLs
git remote -v
# Link a local repository to a remote server
git remote add origin https://github.com/user/repository.git
# Push local commits to remote branch
git push -u origin main
# Fetch changes from remote without merging them
git fetch origin
# Fetch and merge changes in a single command
git pull origin main
2 Code Challenge
Challenge: Create an empty repository on GitHub, map it as the
origin remote on your local test repository, and push your commits to the remote main branch.