Setting vscode as default git editor

Hi Guys,
Can’t anyone help with how to resolve the issue with setting vscode as git default editor?
I get “hint: Waiting for your editor to close the file… error: cannot run vscode: No such file or directory
error: unable to start editor ‘vscode’”
each time I run git config --global -e.

Again, I’m not redirected to the vscode editor.

The executable name of Visual Studio Code is code not vscode.

1 Like

I ran: git config --global diff.tool code
git config --global difftool.code.cmd “code --wait --diff $LOCAL $REMOTE”
git config --global -e

and I still got
hint: Waiting for your editor to close the file… error: cannot run vscode: No such file or directory
error: unable to start editor ‘vscode’

Editing is not diffing. You set the default editor with git config --global core.editor "code --wait" to VSCode if code is in your path. Otherwise replace “code” with the full path to the executable.

1 Like

Please one more question, where and how do I replace “ code ” with the full path to the executable?

What’s the end goal here? I’m a bit confused.

@joshuamwolfe I’m trying to set my git to redirect to vscode when git config --global -e… I’m new to git

Just so everything is clear, why are we redirecting to VScode?

VScode has version control integrated and git is an independent CLI tool. So why we’d have to open VScode with git… so why we’d need to open an editor is confusing.

I want to set vscode as default editor

I can work with that!

Follow this guide, I tested it, it works.

1 Like

@joshuamwolfe Thank you!!!

1 Like

@Jonathan ?!?
@joshuamwolfe’s link tells you exactly to do what I told you to do. Which is BTW exactly what Mosh told you to do.
You set vscode as your default editor while you should have set it to code.

Hopefully I didnt cause any trouble… :confused:

I followed the instructions on the link and also what Mosh gave in this lecture but I still get “zsh: command not found: code” when I run code audience.txt

hint: Waiting for your editor to close the file… code --wait: code: command not found
error: There was a problem with the editor ‘code --wait’.

You didn’t add VS Code to your path. Follow the installation instructions for your operating system.

1 Like

hello jonathan did you find the solution to the problem to this error when executing the command git config --global -e, I get the same error as you, I await your response thanks.
hint: Waiting for your editor to close the file… code --wait: code: command not found
error: There was a problem with the editor ‘code --wait’.