Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set VScode as core editor in git /macbook

I cannot set Visual Studio Code as my core editor for git. When I'm trying to do the git commit I only see the info that there is a problem with editor.

MacBook-Air-Agata:~ agataskrzypczyk$ git config --global core.editor "/Applications/Visual Studio Code.app" --wait

MacBook-Air-Agata:~ agataskrzypczyk$ git config --global core.editor
/Applications/Visual Studio Code.app

MacBook-Air-Agata:~ agataskrzypczyk$ cd nowy

MacBook-Air-Agata:nowy agataskrzypczyk$ git commit

hint: Waiting for your editor to close the file... /Applications/Visual Studio Code.app: /Applications/Visual: No such file or directory
error: There was a problem with the editor '/Applications/Visual Studio Code.app'.
Please supply the message using either -m or -F option.
MacBook-Air-Agata:nowy agataskrzypczyk$
like image 252
Agata Skrzypczyk Avatar asked Mar 27 '19 21:03

Agata Skrzypczyk


People also ask

How do I change the default git editor?

The command to do this is git config --global core. editor "nano" . You can change the highlighted section with your editor of choice!


2 Answers

I suggest you to set Visual Studio Code option to be launched from command line. For this follow the instructions in the documentation here.

  • Launch VS Code.
  • Open the Command Palette (⇧⌘P) and type 'shell command' to find the Shell Command: Install 'code' command in PATH command.

Then try setting core editor with this command:

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

And then I think you'll not have problems with git commit.

like image 133
Diogo Rocha Avatar answered Oct 10 '22 06:10

Diogo Rocha


git config --global core.editor "code"
like image 24
Everton Sales Avatar answered Oct 10 '22 06:10

Everton Sales