-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error: unable to start editor '' (error: cannot spawn : No such file or directory) #2011
Comments
Does it work if you replace the backslashes by forward slashes? |
I tried all of the following and none worked:
I even renamed the folder to
The error is always
It seems like something is fundamentally broken in the way Git tries to launch another program. |
Just wondering if this has a long tail link to #2001, and onward to #2007, which is a recent change noted as:
|
Sounds probable, especially because
|
Interestingly, VS Code is also started successfully for |
@Simran-B could you test with v2.21.0-rc0? There are quite a few getenv()-related fixes and workarounds in that version. |
First, I verified that the error occurs in Command Prompt, PowerShell as well as Git Bash using v2.20.1 - it does. So it shouldn't matter which terminal is used to check if a particular version is broken or not. Next, I downloaded the PortableGit 2.21.0 64-bit packages of rc0, rc1 and rc2 and tried the same command in git-bash.exe and git-cmd.exe. I also tried: ... but to no avail 😞 Finally, I tried to find the last working version: So it was broken somewhere between 2.19.1 and 2.19.2, except that there is exactly one RC (2.19.0.rc0.windows.2) which is also broken, but not the preceding and following release candidates - what on earth?! |
Found the answer here: git-for-windows/build-extra#203 (comment)
|
@Simran-B thank you for your patient reporting and testing. What you found is an odd thing, indeed, until one realizes that there are two ways to launch the editor: one from The Unix shell scripts have no problem with the single quotes, but So what I am doing right now is to change the installer to use double quotes when configuring the editor. |
This fixes git-for-windows/git#2011, and while at it also starts supporting system-wide Sublime Text installations. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
The installer [now configures editors so that the built-in rebase can use them](git-for-windows/git#2011). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho Sorry but it seems to be broken still. I manually changed Then I set it to something random to test the installer:
I installed the 64-bit snapshot and verified that
But this still errors out for the built-in rebase, no matter if I use cmd, Powershell or git-bash:
Also tested if the spaces in the editor path might cause this, but they don't:
|
Can you re-run the |
For me, VS Code opens correctly, and the log up to that point reads: $ GIT_TRACE=1 git rebase -i HEAD^
11:23:07.400499 exec-cmd.c:236 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
11:23:07.400499 git.c:419 trace: built-in: git rebase -i HEAD^
11:23:07.400499 run-command.c:643 trace: run_command: git config --bool rebase.usebuiltin
11:23:07.420499 exec-cmd.c:236 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
11:23:07.422499 git.c:419 trace: built-in: git config --bool rebase.usebuiltin
11:23:07.446499 run-command.c:643 trace: run_command: GIT_CHERRY_PICK_HELP='Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".' git rebase--interactive --autosquash --upstream=bf91b39e3c32f5b7e5a2660feea7b832d21bc7c2 --onto=bf91b39e3c32f5b7e5a2660feea7b832d21bc7c2 --onto-name=HEAD^ --head-name=refs/heads/master --allow-empty-message
11:23:07.464496 exec-cmd.c:236 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
11:23:07.468498 git.c:419 trace: built-in: git rebase--interactive --autosquash --upstream=bf91b39e3c32f5b7e5a2660feea7b832d21bc7c2 --onto=bf91b39e3c32f5b7e5a2660feea7b832d21bc7c2 --onto-name=HEAD^ --head-name=refs/heads/master --allow-empty-message
hint: Waiting for your editor to close the file... 11:23:07.493515 run-command.c:643 trace: run_command: '"C:\\Program Files\\Microsoft VS Code\\Code.exe" --wait' C:/git-sdk-64/usr/src/build-extra/.git/rebase-merge/git-rebase-todo
[main 2019-03-01T10:23:08.197Z] update#setState idle |
cmd:
powershell:
git-bash:
There does not seem to be a difference between the terminals, except how you can set (temporary) environment variables and whether The interesting bit is: it tries to launch the file(!), not the editor with file path as argument 😕 VS Code is configured
But even if I also set it for |
Did you notice the two spaces before the file name? I think that your sequence editor is somehow configured to the empty string. Can you see what |
I did not see the extra space to be honest... Does this look good or bad?
The command you suggested does not print anything. With
I also created an empty env var with regedit of my own to compare the behavior and it then printed |
From the git docs:
So you can override which editor should be used for interactive rebases. I just checked my
I removed this section and tada, it works! 🍾 🎈 🎉
No clue how this got into the configuration file though... Was this set by some legacy installer perhaps? Or some misbehaving script, e.g. the chocolatey installer for Git? (can't remember if I installed Git with choco the first time on this machine...) This probably explains why other commands were able to launch VS Code too: They likely use the default editor, which does not get overwritten by the |
Yeah, finally figured it out! |
Setup
defaults?
Details
CMD
Minimal, Complete, and Verifiable example
this will help us understand the issue.
Interactive rebase to start Visual Studio Code
Git was unable to launch Visual Studio Code:
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:
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:
I tried to change the configuration:
This does not work, the quote marks and the
--wait
option disappear. I tried a few variations and ended up with this: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?
The text was updated successfully, but these errors were encountered: