Utility · use it before asking for help
Troubleshoot by layer
First-week Git problems sort into five layers, and the error message almost always names the layer. Find the first one that fails, fix it there, and the rest usually follows.
Find the layer that failed
Symptom table
| Symptom | Layer | Most likely cause | What to do |
|---|---|---|---|
git: not recognized / command not found | A | Git not installed, or the terminal predates the install | Close and reopen the terminal; if unchanged, install from git-scm.com/downloads (Windows: keep the command-line option on) |
| Commit refused: "Please tell me who you are" | B | Name and email never set on this machine | The two git config --global lines on the Set up page, then commit again |
| Commits show the wrong name (a previous student) | B | Shared PC kept the old identity | Re-run the two config lines. Already-made commits stay mislabelled; ask the teacher whether to redo them in a fresh repo |
fatal: not a git repository | – | You are outside the project folder | cd into the folder that contains .git (where you ran git init or git clone); ls to orient |
remote origin already exists | C | You ran remote add twice | git remote set-url origin <url> to change it, or nothing if git remote -v already shows the right address |
Repository not found on push or clone | C/D | URL typo, or a private repo you are not invited to | Compare git remote -v to the address on the repository page; for a partner's repo, accept the collaborator invitation first |
Authentication failed, or push asks for a password and rejects it | D | Raw account passwords do not work over HTTPS; the stored credential is stale or someone else's | Remove the git:https://github.com entry in Windows Credential Manager, push again, sign in through the browser window (see how sign-in works) |
| Push rejected: "fetch first" | E | The remote has commits you have not pulled | git pull, resolve a conflict if one appears, git push. This is the workflow, not a fault |
CONFLICT (content) after a pull or merge | E | Both sides edited the same lines | The four steps: open, decide and delete markers, add, commit; then push |
| First push rejected and you never pulled anything | E | The GitHub repo was created with a README, so the remote has a commit you lack | git pull origin main --no-rebase to merge it, then push; next time create the remote empty (why) |
| Committed a file you meant to keep out (or a wrong edit) | – | Normal week-one accident | Nothing committed is lost: fix forward with a new commit. For uncommitted cases, git restore / restore --staged (the safety net); for the rest, Oh Shit, Git!?! and ask |
Git's messages are instructions, not decoration
Git's error and hint text is unusually good: it names the problem and, in the hint: lines, the command that fixes it. The week-one skill is simply to read it. Two habits:
git statusafter anything surprising. It states which files are modified, staged or conflicted, and prints the way out ("use git add...", "fix conflicts and run git commit").- Search the exact message. Copy the quoted first line of the error into a search; the first results are usually the official docs or a well-answered question. Paste-and-pray commands from forums are the one thing to avoid: prefer the fix you can explain.
Before you ask for help
Bring evidence, and the teacher can help in one minute instead of ten. For this week that means:
- Which layer (A to E) you got stuck at, and the outputs proving the earlier layers pass:
git --version,git config --list,git remote -v. - The full text of the error, copied, not paraphrased.
git statusandgit log --onelinefrom the repository in question.- What you changed since it last worked, and what you already tried.