Reputation: 6988
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)
Upvotes: 8
Views: 41830
Reputation: 803
You don't have permission to access $HOME/.gitconfig
. Use open "$HOME/.gitconfig"
to open the file in your default text viewer.
Upvotes: 4
Reputation: 1769
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)
Upvotes: 4
Reputation: 15650
If you want to edit that file, you should launch an editor and open the file with it.
If you type a file name as a command in a UNIX shell, the OS will try to run that file as a program, but your .gitconfig
doesn't have exec permissions - that's the error you see.
You can try running $EDITOR $HOME/.gitconfig
, which could get expanded to something like vim ~/.gitconfig
(or whatever editor you have in your $EDITOR
env variable).
Upvotes: 2