When I'm using Git on Mac and need to do a rebase, the Vim editor kicks in by default. I would prefer Nano – could someone please explain how to reconfigure Git to make it use Nano for rebase?

  • 6
    I prefer nano too, I am no masochist.
    – Rolf
    Sep 22 '17 at 10:31

git config --global core.editor "nano"

More information here:


  • This is manna from cli heaven 😝 🙌 🎉
    – gdibble
    May 25 '21 at 19:25

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...

  • That's assuming you use Bash B) Mar 25 '16 at 23:09
  • 4
    You should be able to use simply export EDITOR=nano. Oct 18 '16 at 3:20
  • Opening a new terminal window might not be enough to reload .bash_profile.
    – Scott
    Jul 25 '19 at 4:40

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:

    email = bob@sandwich.net
    name = Bob Sandwich
    editor = nano
    tool = vscode
[mergetool "vscode"]
    cmd = "code --wait "
    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"
  • Love the detail here, ty 👍
    – gdibble
    May 25 '21 at 19:27
  • WTF are you doing there? "sudo nano <file in your $home>"? And only for reading a file? To which you've got access anyway? How about... "cat <file in your $home>"? Jun 18 '21 at 7:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy