Ran `git init` in the home folder — Git started tracking the entire home directory. Root cause: Wrong working dir when running init; stray `.git` in `$HOME`. The fix: Check `git rev-parse --show-toplevel`; remove the stray `~/.git`.
A production war story from the TheCodeForge Git series — the incident, why it happened, and the exact fix.
⏳ Timestamps:
0:00 - Cold open: refusing to update checked out branch
0:09 - Intro
0:17 - What Is Git Init?
0:28 - Inside .git
0:43 - Bare Repo Setup
0:53 - Reinitializing Is Safe
1:11 - Templates Customize Init
1:24 - Init vs Clone
1:40 - refusing to update checked out branch
1:55 - Non-bare repo on server
2:07 - The Fix
2:18 - ⚠ Gotcha: Running git init without --bare on server
2:26 - ⚠ Gotcha: Running git init --bare on existing repo
2:34 - ⚠ Gotcha: Assuming hooks are pushed to remotes
2:41 - Version Compatibility: Git 2.28+ Default Branch Name
3:14 - Production Caveat: Permissions on Shared Bare Repos
3:34 - Debugging Guide
3:45 - Interview Questions
4:07 - FAQ
4:27 - Key Takeaways
4:40 - Next up
4:54 - Wrap-up
👉 Full article + code: https://thecodeforge.io/devops/git-init/
⏭ Next up: Git Add, Commit and Status
#git #devops #versioncontrol