By the end of this module, you will:
- understand what a remote repository is
- connect local Git to GitHub
- push and pull code
- collaborate with others
- understand GitHub workflows (PRs, forks)
Local Git = your machine
Remote Git (GitHub) = shared server
[ Your Computer ] ←→ [ GitHub Server ]
(local repo) (remote repo)
flowchart LR
A[Local Repository] <-- push/pull --> B[GitHub Remote Repository]
Without remote:
- your code stays on your machine
- no collaboration
- no backup
With remote:
- share code
- collaborate with team
- backup safely
- deploy projects
1. Write code locally
2. Commit changes
3. Push to GitHub
4. Others pull changes
flowchart TD
A[Write Code] --> B[git add]
B --> C[git commit]
C --> D[git push]
D --> E[GitHub]
E --> F[git pull]
.git/Stores:
- commits
- branches
- history
origin → GitHub URLStored in:
.git/configorigin/main
Represents:
last known state of remote
git push origin main- sends commits to remote
- updates GitHub
git pull- fetch + merge
- updates local repo
git remote add origin <url>
git push -u origin main
git pull
git fetch
git clone <url>- pull before push
- use meaningful commit messages
- avoid force push on shared branches
- verify remote URL
Q: What is a remote repository in Git?
Answer:
A remote repository is a version of your project hosted on a server like GitHub, which allows collaboration and backup. It is connected to your local repository using a URL and managed through commands like push and pull.
Remote = shared Git
- Create GitHub account
- Create repository
- Connect local repo
- Push & pull
- Clone repo
- Fork & PR
👉 Start with: 01-create-github-account.md