Recently I was trying to add some folders to my global .gitignore file on windows. Unfortunately I ran into some issues. After some searching, I couldn’t come across a solution that worked for me. Here are the steps that worked for me.
Add to Global Git ignore Windows
git config --global core.excludesfile ~/.gitignore_global
(Add .gitignore_global as the global gitignore file in your global git config)notepad %USERPROFILE%\.gitignore_global
(Create and edit .gitignore_global in your home directory using cmd)
Add to Global Git ignore Mac
git config --global core.excludesfile ~/.gitignore_global
(Add .gitignore_global as the global gitignore file in your global git config)sudo nano ~/.gitignore_global
(can edit your .gitignore_global file and add any files or folder you would like to ignore. Use ctrl + y to save and exit)
Leave a comment if these steps helped in any way!
There are double dashes for global option. Thanks!!!
““
git config –global core.excludesfile ~/.gitignore_global
““
Thanks for sharing. Do you mean double dashes are required?
Thanks, works.
But yes. Should be
git config –global core.excludesfile ~/.gitignore_global
Thanks for the correction. Funny thing is I had the double dashes but the text displayed as a single dashed. Had to tell the editor it is code so it will display correctly. Thanks!
why sudo nano? This does not make sense for user-wide settings. just using nano/vim/whatever_editor is enough.
sudo gives you rights to be able to save the file.