Git — Remote Repository
Remote Operations
# Add remote
git remote add origin https://github.com/user/repo.git
# View remotes
git remote -v
# Fetch
git fetch origin
# Push
git push origin main
# Pull
git pull origin main
Remote Branches
# List
git branch -r
# Track
git checkout -b local origin/remote
# Delete remote
git push origin --delete branch
Upstream
# Set upstream
git push -u origin main
# View upstream
git branch -vv
Fork Workflow
# Fork on GitHub
# Clone your fork
git clone https://github.com/you/repo.git
# Add upstream
git remote add upstream https://github.com/original/repo.git
# Sync upstream
git fetch upstream
git merge upstream/main
Mini Practice
- Add and manage remotes
- Track remote branches
- Set up upstream
- Fork and sync workflow
Up Next
Continue with Ignore — ignoring files.
Related Topics
Frequently Asked Questions about Remote Repository
What is Remote Repository in Git?
Remote Repository is a fundamental concept in Git. This lesson explains it step by step with clear examples, making it easy for beginners to understand.
How do I learn Remote Repository?
Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Remote Repository.
Why is Remote Repository important in Git?
Remote Repository is essential for Git development. Understanding this concept will help you write better code and solve real-world problems more effectively.