I wanted to edit my .gitconfig
file to change the default editor.
I typed $HOME/.gitconfig
to set the correct directory and got
-bash: /Users/Myself/.gitconfig: Permission denied
.
Why does it happen and what does it mean? How do I get past it?
(OS X Yosemite 10.10.4)
The system level configuration file lives in a gitconfig file off the system root path. $(prefix)/etc/gitconfig on unix systems. On windows this file can be found at C:\Documents and Settings\All Users\Application Data\Git\config on Windows XP, and in C:\ProgramData\Git\config on Windows Vista and newer.
The . git/config file in each repository is used to store the configuration for that repository, and $HOME/. gitconfig is used to store a per-user configuration as fallback values for the . git/config file. The file /etc/gitconfig can be used to store a system-wide default configuration.
If you get the error "Permission denied", it is also possible that git doesn't have permission to create the project folder locally. Check permissions for the directory where you're attempting to check out the project, and make sure you have write access.
Files like gitconfig and . gitconfig are only created when they're first used. If nobody has used the Git global scope to add a remote tracking branch, or nobody's updated the system scope to set the default Git editor to Notepad++, then the gitconfig and . gitconfig files may very well not exist in the first place.
Just use git command :
git config --global core.editor your-favorite-editor
--global
instructs git to change your global config (effectively stored in $HOME/.gitconfig), adding the following line in the [core] section :
editor=your-favorite-editor
You can add it by hand; but for that, as said by others, you mustn't try to execute $HOME/.gitconfig, but you have to open it (with a text editor)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With