Git on Mac: How to set Nano as the default text editor?

git config --global core.editor "nano"

More information here:

http://git-scm.com/book/en/Customizing-Git-Git-Configuration


If you want to use nano as your editor for all things command line, add this to your bash_profile:

export EDITOR=/usr/bin/nano

This is assuming you're using the system nano. If not, edit to suit where your nano lives (e.g. /usr/local/bin, /opt/local/bin)

Remember to source your bash_profile after setting this or open a new terminal window for the settings to work...


I just learned a moment ago that there (on OSX anyway) is a file at /Users/<USER_NAME>/.gitconfig

$ sudo nano /Users/bob/.gitconfig

Then you should see something like this:

[user]
    email = [email protected]
    name = Bob Sandwich
[core]
    editor = nano
[merge]
    tool = vscode
[mergetool "vscode"]
    cmd = "code --wait "
[diff]
    tool = vscode
[difftool "vscode"]
    cmd = "code --wait --diff  "

After seeing that structure, you can intuitively understand something like (ie: core.editor):

git config --global core.editor "nano"

Tags:

Macos

Vim

Git

Nano