How to fix warning: unable to access global gitignore file in Git

GitBEGINNERLOWUpdated Dec 6, 2025ยท 123 views

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.

Quick fix

Fixes warning: unable to access global gitignore file

git config --global core.excludesfile
  1. Check the configured global gitignore path
  2. Create the missing global gitignore file
  3. Populate the global gitignore with common patterns
  4. Set core.excludesfile with absolute path
git โ€” error
git config --global core.excludesfile
warning: unable to access global gitignore file

What this error means

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.

Typical symptoms

  • Warning message "unable to access global gitignore file" appears when running git commands
  • Files like .DS_Store or .vscode/ appear in git status across multiple repositories
  • Running `git config --global core.excludesfile` shows a path that does not exist
  • Editor-specific or OS-specific files are not being ignored globally as expected
  • The warning appears after setting up a new machine or user account

Common causes

  1. The global gitignore file was configured but never created
  2. Typo in the file path when setting core.excludesfile (e.g., "excludefile" instead of "excludesfile")
  3. Relative path used instead of absolute path in core.excludesfile configuration
  4. The global gitignore file was deleted or moved after being configured
  5. Local repository config has incorrect core.excludesfile that overrides global setting
  6. Windows path encoding issues or incorrect use of environment variables like %USERPROFILE%

How to fix "warning: unable to access global gitignore file"

1Check the configured global gitignore path

First, verify what path Git is trying to access:

bash
git config --global core.excludesfile

If this returns nothing, Git is using the default location ~/.config/git/ignore. If it returns a path, verify whether that file exists:

bash
ls -la ~/.gitignore_global  # Replace with your configured path
2Create the missing global gitignore file

Create the file at the configured location:

bash
# If using the default location
mkdir -p ~/.config/git
touch ~/.config/git/ignore

Or if you have a custom location configured:

bash
touch ~/.gitignore_global  # Replace with your configured path
3Populate the global gitignore with common patterns

Add common patterns that should be ignored across all repositories:

bash
# macOS
.DS_Store
.AppleDouble
.LSOverride

# Windows
Thumbs.db
Desktop.ini

# Linux
*~

# Editors
.vscode/
.idea/
*.swp
*.swo
.sublime-project
.sublime-workspace

# Other
.envrc

You can use [gitignore.io](https://www.toptal.com/developers/gitignore) to generate patterns for your specific setup.

4Set core.excludesfile with absolute path

If the path is incorrect or missing, configure it properly with an absolute path:

bash
# Using tilde expansion (recommended)
git config --global core.excludesfile ~/.gitignore_global

On Windows (use forward slashes):

cmd
git config --global core.excludesfile C:/Users/YourUsername/.gitignore_global

Avoid using relative paths as they are interpreted relative to each repository.

5Check for local repository config override

If the issue persists in a specific repository, check if local config is overriding the global setting:

bash
# Inside the repository
git config core.excludesfile

If this returns a different (incorrect) path, remove it:

bash
git config --unset core.excludesfile

Or edit .git/config directly and remove the [core] section entry for excludesfile.

6Verify the fix

Confirm Git can now access the file:

bash
# This should complete without warnings
git status

Test that patterns are working:

bash
# Create a test file that should be ignored
touch .DS_Store
git status  # Should not show .DS_Store

Use git check-ignore to debug specific files:

bash
git check-ignore -v .DS_Store
# Should show: ~/.gitignore_global:1:.DS_Store

Advanced notes

Common 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.

Frequently asked questions

What does "warning: unable to access global gitignore file" mean?
excludesfile) but cannot find or access it. DS_Store. git/info/exclude file.
How do I fix "warning: unable to access global gitignore file"?
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.
What causes "warning: unable to access global gitignore file"?
The global gitignore file was configured but never created Typo in the file path when setting core.excludesfile (e.g., "excludefile" instead of "excludesfile") Relative path used instead of absolute path in core.excludesfile configuration
Is the "warning: unable to access global gitignore file" error serious?
It is a low-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading