1

I've been trying to set Notepad++ as my default editor from Git-bash but when I run this command:

git config core.editor "notepad++ -multiInst -nosession"

I get this error:

fatal: not in a git directory

How can I do this?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
  • Are you running that command in a git repository? – Stephen Newell Mar 26 '21 at 20:15
  • Yes, I'm using $ MINGW64 GIT. I think I could set it. but when I open the notepad++ from git bash, then it opens the last opened tab. how I can make it to open completely a new instance of the notepad++ editor? – Noorullah Rahimi Mar 26 '21 at 20:22
  • 1
    Most of the time, "git directory" means a working copy. You're likely running this command in a random directory, and the solution for this is already in an answer. – Stephen Newell Mar 26 '21 at 20:24
  • Does this answer your question? [Why can't I set notepad++ as my git commit editor in Windows 10?](https://stackoverflow.com/questions/52389455/why-cant-i-set-notepad-as-my-git-commit-editor-in-windows-10) – Michael Freidgeim Mar 09 '23 at 00:58

2 Answers2

1

You've forgotten something in your command in your Git : if you're running x64 machine then try this command

$ git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"

The exact location of notepad++ should be placed there with the necessary parameters.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Sarwar Sateer
  • 395
  • 3
  • 16
  • I'm not sure if whether or not it's an x64 machine is relevant for this error. – mkrieger1 Mar 26 '21 at 20:30
  • 1
    It worked. but when I try to open Notepad++ from Git Bash, then it opens the previously opened tab. How can I create a new instance when I call Notepad++ from Git Bash? – Noorullah Rahimi Mar 26 '21 at 20:32
0

git config by default affects the configuration for a specific repository. If you are not in a repository you will get the error you have seen.

If you want to make a user-wide configuration that is not specific to a repository, use git config --global instead.

See: What is the difference between global and local configuration in git?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65