Use the git config command to point Git to a custom location for storing the listing of files to ignore in repositories.
Additionally, the setting can be added by editing the config file directly. The config file is at the root of the user's home directory and is named ".gitconfig."
Most articles around the Web instructing users how to ignore specific types of files across repositories, describe creating a file named ".gitignore." Almost without fail, the instructions suggest putting the .gitignore file at the root of the user's home direcory.
The expectation is that this is a location that Git looks at by default to pick up any files that it should ignore. It does not. Rather, the default locations that Git looks to are:
If the first place is not found, then the second place is checked. Git will not look at ~/.gitignore by default. Use one of the methods described above to add it.
This information is all available from the official Git documentation, but sometimes certain issues aren't called out specifically.
git config --global core.excludesfile ~/.gitignore
Additionally, the setting can be added by editing the config file directly. The config file is at the root of the user's home directory and is named ".gitconfig."
Most articles around the Web instructing users how to ignore specific types of files across repositories, describe creating a file named ".gitignore." Almost without fail, the instructions suggest putting the .gitignore file at the root of the user's home direcory.
~/.gitignore
The expectation is that this is a location that Git looks at by default to pick up any files that it should ignore. It does not. Rather, the default locations that Git looks to are:
- $XDG_CONFIG_HOME/git/ignore
- $HOME/.config/git/ignore
If the first place is not found, then the second place is checked. Git will not look at ~/.gitignore by default. Use one of the methods described above to add it.
This information is all available from the official Git documentation, but sometimes certain issues aren't called out specifically.
Comments
Post a Comment