This guide helps Windows developers set up their environment to work with this project's Git hooks (Husky + lint-staged).
Download and install Git for Windows which includes Git Bash.
Important: During installation, make sure to select:
- "Git from the command line and also from 3rd-party software"
- "Use Windows' default console window" OR "Use MinTTY"
Download and install Node.js (LTS version recommended).
git clone <repository-url>
cd alphlandnpm installThis will automatically set up Husky hooks via the prepare script.
If you encounter issues with line endings:
git config core.autocrlf trueCheck if hooks are installed:
ls -la .husky/You should see pre-commit and commit-msg files.
Solution: Reinstall husky hooks:
npm run prepareSolution: Make sure Git Bash is installed and available in your PATH:
where sh
# Should output: C:\Program Files\Git\bin\sh.exe (or similar)Solution: Fix the linting errors before committing:
# Check for linting errors
npm run lint
# Format code
npm run formatDo NOT use git commit --no-verify unless absolutely necessary, as it bypasses important code quality checks.
Potential causes:
- Code quality issues: Check the error message - it usually shows ESLint/Prettier errors
- Shell not found: GitHub Desktop might not find Git Bash
Solution for GitHub Desktop:
- Fix any ESLint/Prettier errors first
- Make sure GitHub Desktop is using the correct Git installation:
- File → Options → Git
- Ensure it points to your Git for Windows installation
-
Stage your changes:
git add <files>
-
Commit (hooks will run automatically):
git commit -m "type: description"
Commits must follow this format: type: description
Allowed types:
feat- add a new featurefix- bug fixchore- tool, configuration changesdocs- documentation updaterefactor- code changes, no new featurestest- add/update tests
Examples:
git commit -m "feat: add user authentication"
git commit -m "fix: resolve login button styling"
git commit -m "chore: update dependencies"-
Pre-commit hook runs:
- ESLint checks and auto-fixes code
- Prettier formats code
- If errors can't be auto-fixed, commit is blocked
-
Commit-msg hook runs:
- Validates commit message format
- Blocks commit if format is invalid
If you continue to experience issues:
- Check if Node.js and Git are in your PATH:
node --version && git --version - Try running hooks manually:
npm run precommit-hook - Check the error messages carefully - they usually indicate the exact problem
- Ask the team for help!
For the best experience on Windows, consider using WSL2:
- Install WSL2: https://docs.microsoft.com/en-us/windows/wsl/install
- Install Node.js in WSL
- Clone and work with the project inside WSL
- Use VS Code with the WSL extension