1

I had been successfully running the command git rebase main -i to rebase my work but out of the blue (or at least I didn't notice if I did anything to change the environment) I start getting the following error:

hint: Waiting for your editor to close the file... error: There was a problem with the editor ''/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/git/dist/scripts/git-editor.sh''.

All other git commands like git commit etc. work normally.

The only other search results I got from stackoverflow are: How can I fix git commit error "Waiting for your editor to close the file..." with VS Code? but that error was for git commit and I did try the suggestions in there like running:

git config --global core.editor "code --wait"

with both single and double quotes. Does anyone have any idea or suggestions on how to resolve this?

huijing
  • 398
  • 2
  • 15
  • It looks like VSCode overrode your choice of editor with *its* choice of editor. Then VSCode's choice of editor failed to work. You can either pester the VSCode people about this to attempt to get them to fix it, or just work around it by overriding their choice again with your choice: Git will use the *first* editor that turns up in the list described in [the `git var` documentation](https://git-scm.com/docs/git-var), but this leaves out the special case of the rebase editor which is `GIT_SEQUENCE_EDITOR` or `sequence.editor` (in that order). – torek May 26 '22 at 13:24
  • That is, for editing the instruction sheet, `git rebase -i` tries `$GIT_SEQUENCE_EDITOR`. If that's not set it tries `git config --get sequence.editor`. If that's not set it tries `$GIT_EDITOR`. If that's not set it tries `git config --get core.editor`. If that's not set, it continues on, all as described by `git var --help`. Any *local* `git config` setting will override a *global* setting but the env vars will override even the local settings. – torek May 26 '22 at 13:26
  • I jumped the gun with my answer below because even though `git rebase main -i` ran without issue, when I need to run `git rebase --continue`, it borked out again. I will check if anyone raised issues on the vscode side. – huijing May 27 '22 at 01:28

1 Answers1

0

Based on the comments from @torek, I ran the following:

git config --global sequence.editor "nano -w"

and now everything is back to normal.

Update:

Unfortunately, I only just discovered after resolving a merge conflict that git rebase --continue still borks out.

huijing
  • 398
  • 2
  • 15
  • The `--continue` just resumes the rebase from where it left off - it won't re-run the sequence editor. Not sure what "borks out" means exactly (can you cut-and-paste any error messages?). – torek May 27 '22 at 05:07
  • Oh sorry for being vague. It just prints the same error message as above: `hint: Waiting for your editor to close the file... error: There was a problem with the editor ''/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/git/dist/scripts/git-editor.sh''.` – huijing May 29 '22 at 01:14
  • OK, that's running a *different* editor setting, from `core.editor` or `$GIT_EDITOR` or `$EDITOR` or `$VISUAL`. Git has a myriad of different settings ([a maze of twisty little passages, all alike](https://en.wikipedia.org/wiki/Colossal_Cave_Adventure)), with a specific reason for each setting, but in general you should set the "most general" one (usually `core.editor` or `GIT_EDITOR`) and let things go from there. Should you need to override something more specific, such as the sequence editor, for some reason, *then* you set the more-specific override *as well*. – torek May 29 '22 at 02:16