Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bash: nano: command not found at Windows git bash

I am using git version 2.7.0.windows.1 on a windows pc, I used the following command:

$ nano README

which results me:

bash: nano: command not found

Now how can I install nano text editor to git bash?

like image 576
Rubel Hassan Avatar asked Apr 22 '16 20:04

Rubel Hassan


People also ask

How do I open nano editor in Git bash?

GNU Nano is yet another text editor for the Unix system that comes pre-installed with Git Bash. If you are working in command prompt in windows then you might not be able to open Nano as the text editor. Nano can be opened inside Git Bash by typing "nano" as the command.

How do I run a nano command in Windows?

Just use the arrow keys on your keyboard to move the cursor around the text. At the bottom of the window, you can find some shortcuts to use with the Nano editor. The “^” (caret) means that you must press CTRL (Windows) or control (macOS) to use the chosen command.

Does nano work on Windows?

GNU nano is a great text editor for developers who work on Linux, but did you know it can run on Windows too? This guide will show you how to install GNU nano on Windows to make your text editing experience seamless.

Does git bash have nano?

and Rejoice with the new ability of nano-power from git bash.


3 Answers

Little modification of the previous solution (@Simopaa) is worked for me on Windows 10 (without Chocolatey):

  1. Download nano-git
  2. Move the nano-git-xxx.exe to (for example) C:\Program Files\Git\bin.

  3. Modify the .gitconfig file with the following (single and double quotes are important):

    [core]
    editor = "winpty '/c/Program Files/Git/bin/nano-git-0d9a7347243.exe'"
    
  4. (Optional step) Make nano available for editing in general:

    Create or edit the one of the startup script of bash (e.g. ~/.bash_profile) with the followings:

    export PATH="/c/Program Files/Git/bin:$PATH"
    alias nano="winpty nano"
    
like image 164
aszoke Avatar answered Sep 24 '22 10:09

aszoke


If anyone's still struggling with this, here's how I managed to get it working.

  1. Download nano-git from https://www.nano-editor.org/dist/win32-support/
  2. Move the exe to (for example) C:\Program Files\Git\bin. I renamed it to nano.exe.
  3. Run nano in bash with winpty nano
  4. Add the following to .gitconfig to make nano your default editor:

[core] editor = winpty C:/Program Files/Git/bin/nano.exe

There might be a more elegant solution, but this works for me.

like image 44
Simopaa Avatar answered Sep 24 '22 10:09

Simopaa


If you already have nano install in your system, you just need to add the path of the exe file to PATH.

To do it just for Git bash, you can open GITINSTALL_DIR\etc\profile with any text editor and add this line to it:

export PATH="/DriveLetter/PATH/TO/YOUR/NANO:$PATH"

Of course you need to change the path above according to your case.

If you havn't installed it yet, just download and put it under GITINSTALL_DIR\bin or any folder included in $PATH

like image 41
gdlmx Avatar answered Sep 23 '22 10:09

gdlmx