Git cannot access the global gitignore file specified in core.excludesfile configuration. This warning appears when the configured path does not exist or is inaccessible.
This warning occurs when Git tries to read the global gitignore file (configured via core.excludesfile) but cannot find or access it. The global gitignore file is used to specify ignore patterns that apply across all repositories on your system, typically for editor-specific files like .vscode/ or operating system files like .DS_Store. When Git encounters this issue, it will continue to work normally but will only use repository-specific .gitignore files and the .git/info/exclude file. Files that should be ignored globally may still appear in git status or be accidentally committed. The configuration setting core.excludesfile points to a file location, but Git does not automatically create this file - you must create it manually. If the path contains typos, uses a relative path incorrectly, or points to a file that was deleted, this warning will appear.
First, verify what path Git is trying to access:
git config --global core.excludesfileIf this returns nothing, Git is using the default location ~/.config/git/ignore. If it returns a path, verify whether that file exists:
ls -la ~/.gitignore_global # Replace with your configured pathCreate the file at the configured location:
# If using the default location
mkdir -p ~/.config/git
touch ~/.config/git/ignoreOr if you have a custom location configured:
touch ~/.gitignore_global # Replace with your configured pathAdd common patterns that should be ignored across all repositories:
# macOS
.DS_Store
.AppleDouble
.LSOverride
# Windows
Thumbs.db
Desktop.ini
# Linux
*~
# Editors
.vscode/
.idea/
*.swp
*.swo
.sublime-project
.sublime-workspace
# Other
.envrcYou can use [gitignore.io](https://www.toptal.com/developers/gitignore) to generate patterns for your specific setup.
If the path is incorrect or missing, configure it properly with an absolute path:
# Using tilde expansion (recommended)
git config --global core.excludesfile ~/.gitignore_globalOn Windows (use forward slashes):
git config --global core.excludesfile C:/Users/YourUsername/.gitignore_globalAvoid using relative paths as they are interpreted relative to each repository.
If the issue persists in a specific repository, check if local config is overriding the global setting:
# Inside the repository
git config core.excludesfileIf this returns a different (incorrect) path, remove it:
git config --unset core.excludesfileOr edit .git/config directly and remove the [core] section entry for excludesfile.
Confirm Git can now access the file:
# This should complete without warnings
git statusTest that patterns are working:
# Create a test file that should be ignored
touch .DS_Store
git status # Should not show .DS_StoreUse git check-ignore to debug specific files:
git check-ignore -v .DS_Store
# Should show: ~/.gitignore_global:1:.DS_StoreCommon pitfall: the configuration key is core.excludesfile (with "file"), not core.excludesfiles (plural). Git will not warn you about typos in configuration keys, so double-check the spelling.
Default location: If you do not set core.excludesfile, Git looks for $XDG_CONFIG_HOME/git/ignore or ~/.config/git/ignore by default. Using this default location means you do not need to configure anything - just create the file.
Best practices: Global gitignore should contain only editor-specific, IDE-specific, or OS-specific patterns (like .vscode/, .idea/, .DS_Store, Thumbs.db). Project-specific ignores (like node_modules/, dist/, .env) should go in the repository's .gitignore file so they are shared with other developers.
Windows-specific: If using PowerShell to set the path, it may not expand environment variables correctly. Use cmd.exe or hard-code the full path with forward slashes. Also ensure the file encoding is UTF-8 or ANSI, not UTF-16 LE.
Already tracked files: If files matching your global ignore patterns are already tracked by Git, they will not be ignored. You must first untrack them with git rm --cached <file> before the ignore rules take effect.
warning: BOM detected in file, this may cause issues
UTF-8 Byte Order Mark (BOM) detected in file
fatal: Server does not support --shallow-exclude
Server does not support --shallow-exclude
warning: filtering out blobs larger than limit
Git partial clone filtering large blobs warning
fatal: Server does not support --shallow-since
Server does not support --shallow-since in Git
kex_exchange_identification: Connection closed by remote host
Connection closed by remote host when connecting to Git server