VSCode as Git editor on Windows Subsystem for linux (WSL)

Obeyda

Context

System Information (Windows)

OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.17134 N/A Build 17134
...
System Type:               x64-based PC
Processor(s):              1 Processor(s) Installed.
                           [01]: Intel64 Family 6 Model 158 Stepping 10 GenuineIntel ~3696 Mhz
BIOS Version:              American Megatrends Inc. 2.20, 10/27/2017

System Information (WSL)

OS: Debian
Kernel: x86_64 Linux 4.4.0-17134-Microsoft
Shell: zsh 5.3.1
CPU: Intel Core i7-8700K CPU @ 3.696GHz
RAM: 8041MiB / 16344MiB

Git

I have this in my ~/.gitconfig:

[core]
    editor = code --wait

Problem:

When I run git commit, vscode starts with C:\mnt\$PathToRepo$\.git\COMMIT_EDITMSG, but this file is empty (it's supposed to have changes to be commited + a diff).

And when I write a commit message, save and exit, I get this in the terminal:

Aborting commit due to empty commit message.

Note:

when i do this:

  1. run git commit;

  2. write commit message in vscode (ex: Initialize repo), save and close;

  3. after the Aborting commit due to empty commit message., i run git commit again;

VSCode will open with the same commit message i wrote in step 2 (ie: Initialize repo)

noornashriq

If the whole point is to to use WSL git on vscode, here is the official solution: https://code.visualstudio.com/docs/remote/wsl.

Essentially, you just need to install the Remote Development Extension Pack.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Windows Subsystem Linux VSCode path

How can I change WSL (Windows Subsystem Linux) terminal font color in vscode?

What is the default shell in the Windows Subsystem for Linux (WSL)?

Installing mitmproxy on Windows Subsystem for Linux (WSL)

A better terminal experience for Windows Subsystem for Linux(WSL)?

Windows Subsystem for Linux (wsl) - Get Default Version

How to use MySQL in WSL (Windows Subsystem for Linux)?

Can ddev work with WSL (Windows Subsystem for Linux)?

No internet connection on WSL Ubuntu (Windows Subsystem for Linux)

Laravel Sail on Windows Subsystem for Linux (wsl)

User accounts under WSL (Windows Subsystem for Linux)

What is the system distribution in the Windows Subsystem for Linux (WSL)?

How to open VSCode from a Windows Linux Subsystem?

VSCode: use WSL Git instead of Git for Windows

How to make a Tape Drive available in Windows Subsystem for Linux (WSL)?

The status of the previously created Ubuntu folders in Windows Subsystem for Linux (WSL)

ssh-agent reset in Windows Subsystem for linux (WSL)

ssh-agent reset in Windows Subsystem for linux (WSL)

Windows Subsystem for Linux (WSL) not actually saving $DOCKER_HOST

Upgrade of Linux Subsystem for Windows 10 (WSL) to Ubuntu 16.04 not working

How do I change the language of the Linux subsystem in Windows 10 (WSL)?

Using Windows Subsystem for Linux (WSL) from Sublime Text

Intermittent, random 'file not found' errors under Windows Subsystem for Linux (WSL)

Open URL with VIM in Ubuntu WSL (Windows Subsystem for Linux)

Visual Studio Code, Python linting with WSL (Windows Subsystem for Linux)

How can I reset the Windows Subsystem for Linux (WSL) back to defaults?

Find active serial ports in Windows Subsystem for Linux (WSL)

How to run RediSearch module with Redis on WSL (Windows Subsystem for Linux)

Is it possible to install IBM java on Windows Subsystem for Linux (WSL) - Ubuntu?