3

There are many questions throughout SO about using VSCode as git's default editor.

The answer to all of them is to set

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

(or "code -w")

However, this isn't behaving properly for me. I don't know if it's related, but I'm doing this via Remote SSH. And indeed, setting "code --wait" and then trying an interactive rebase gives me:

$ git rebase -i --root
hint: Waiting for your editor to close the file...

So the --wait flag is clearly doing what it's meant to do. Likewise, a new tab is opened titled "git-rebase-todo"! However, the tab is empty except for an error: "The editor could not be opened because the file was not found."

enter image description here

If I try to open the file in a second tab, it also shows the same error. If I close the file, the rebase proceeds normally (as if I'd accepted the default "pick-all" setting).

I've also seen some references to using "code -n --wait", and this does actually work!... sort of. It gets the job done, but since -n creates a new window, this actually generates a new SSH connection for each step (if I mark 10 commits as "edit", then it will open each commit in a new window, each of which takes a few seconds to complete the SSH connection).

Is there a way for this to "just work"? A setting that works across a "Remote SSH" connection that simply opens a new tab with the git-rebase-todo file that I can modify as needed and then all changes happen on the one window I'm using?


For the record, using nano or some other terminal-based editor works as intended: I make the changes there, and then the entire rebase happens one commit at a time on the currently open window/connection. I just want this same behavior without having to use a terminal-based editor.

Also, other operations (i.e. writing commit messages) work as expected with VSCode. The issue seems to only be when rebasing.

Wasabi
  • 2,879
  • 3
  • 26
  • 48
  • Did you ever find a work around? I've hit the same issue. – ADataGMan Mar 29 '23 at 10:38
  • It just... started working. No idea what happened, sorry. – Wasabi Mar 30 '23 at 12:15
  • Hitting the same thing. I get: Error: connect ENOENT /run/user/1002/vscode-ipc-b2d6f9ce-291a-49e1-9391-4a02037a5084.sock at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1157:16) { errno: -2, code: 'ENOENT', syscall: 'connect', address: '/run/user/1002/vscode-ipc-b2d6f9ce-291a-49e1-9391-4a02037a5084.sock' } error: There was a problem with the editor 'code --wait'. – httpete Mar 31 '23 at 13:28

0 Answers0