1

I'm using msysgit on Windows, and occasionally, when it should open my editor to allow me to edit a commit message or something, it tries to open a file called $@ instead. The file doesn't exist, so Notepad++ says "The file '$@' doesn't exist; would you like to create it?"

My .git/config looks like:

[core]
    editor = C:/Program\\ Files/notepad++/notepad++.exe
MatrixFrog
  • 20,873
  • 10
  • 56
  • 88
  • haha, I saw `git` and `"$@"?` in the question title, and figured it was an expletive :) – Benjol Dec 01 '10 at 06:11
  • Looks like a problem with variable expansion, but after mulling it for a minute or two, I can't think of exactly where it goes wrong. It may be that Git thinks the program is doing variable expansion (as Windows programs do) and the program expects the shell to have done it. Wouldn't make much sense, though, given that Notepad++ is a regular Windows program. – siride Dec 01 '10 at 06:51
  • 1
    http://stackoverflow.com/questions/10564/how-can-i-set-up-an-editor-to-work-with-git-on-windows/773973#773973 should help – VonC Dec 01 '10 at 06:51

2 Answers2

0

I had exactly the same problem too. I have tried to write this string in different ways. Finally I've found a right variant.

[core]
editor = 'C:/Program\\ Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin

The single quotes must be presented. I don't know why or how, but it works (in my case). May somebody will explain the reason of such behavior. I hope this comment is helpfull.

Oleg
  • 1
-1

I haven't found exactly why this is happening, but searching around in the msysgit Google group led me to the conclusion that it seems to have something to do with the space in "Program Files." What seems to solve the problem is adding C:\Program Files\Notepad++ to the PATH environment variable, and then switching the git config to just notepad++. I would still like to know why this wasn't working, and why this solution apparently fixes it, though.

MatrixFrog
  • 20,873
  • 10
  • 56
  • 88
  • You could create a shell script or a batch script that runs Notepad++ and then just invoke that from the Git config. I've had to do this on msys a lot because of various expansion and escape issues. Git seems to be even more finicky than msys bash, alas. – siride Dec 01 '10 at 06:52