Skip to content

error: unable to start editor '' (error: cannot spawn : No such file or directory) #2011

Closed
@Simran-B

Description

@Simran-B
  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
git version 2.20.1.windows.1
cpu: x86_64
built from commit: 7c9fbc07db0e2939b36095df45864b8cda19b64f
sizeof-long: 4
sizeof-size_t: 8
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
Microsoft Windows [Version 10.0.17134.472] (Pro, 64-bit)
  • What options did you set as part of the installation? Or did you choose the
    defaults?
Editor Option: VisualStudioCode
Custom Editor Path:
Path Option: Cmd
SSH Option: OpenSSH
CURL Option: OpenSSL
CRLF Option: CRLFAlways
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Enabled

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

CMD

git rebase -i HEAD~2
  • What did you expect to occur after running these commands?

Interactive rebase to start Visual Studio Code

  • What actually happened instead?

Git was unable to launch Visual Studio Code:

hint: Waiting for your editor to close the file... error: cannot spawn : No such file or directory
error: unable to start editor ''

I then ran the Git setup again and made sure that Visual Studio Code is selected as default editor, but after re-installation and opening a new command prompt, the same problem still occurred.

Then I checked the configuration:

$ git config --global core.editor
'C:\Users\Simran\AppData\Local\Programs\Microsoft VS Code\Code.exe' --wait

If I use Ctrl+R for this very command in single quote marks, an error occurs (not found). If I replace the single quote marks by double quote marks, VSCode is launched successfully:

"C:\Users\Simran\AppData\Local\Programs\Microsoft VS Code\Code.exe" --wait

I tried to change the configuration:

$ git config --global core.editor "C:\Users\Simran\AppData\Local\Programs\Microsoft VS Code\Code.exe" --wait
$ git config --global core.editor
C:\Users\Simran\AppData\Local\Programs\Microsoft VS Code\Code.exe

This does not work, the quote marks and the --wait option disappear. I tried a few variations and ended up with this:

$ git config --global core.editor "\"C:\Users\Simran\AppData\Local\Programs\Microsoft VS Code\Code.exe\" --wait"

$ git config --global core.editor
"C:\Users\Simran\AppData\Local\Programs\Microsoft VS Code\Code.exe" --wait

This looked promising, but the interactive rebase still fails with the same error message (same if I don't add quote marks). How to properly configure Git for VSCode under Windows?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions