18 lines
No EOL
534 B
Markdown
18 lines
No EOL
534 B
Markdown
# Git Basics
|
|
|
|
## git push — remote vs branch syntax
|
|
|
|
**Problem:** `git push -u main` throws:
|
|
fatal: 'main' does not appear to be a git repository
|
|
fatal: Could not read from remote repository.
|
|
|
|
**Diagnosis:** Git expected a remote name but got a branch name.
|
|
|
|
**Fix:**
|
|
git push -u origin main
|
|
|
|
**Key insight:** The syntax is always remote first, branch second.
|
|
`origin` = where to push (the remote repository)
|
|
`main` = which branch to push
|
|
`-u` = sets origin/main as the default tracking branch,
|
|
so future pushes only need `git push` |