9
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

VSCodeでWSLのGitを使う(Ubuntu 18.04)

Last updated at Posted at 2018-06-29

VSCodeにはバージョン管理の機能が統合されています。

Using Version Control in VS Code

しかし、WSL上のワークスペースをVSCodeで開いた際に、WSLのGitを参照してくれません:sob:

image.png

GithubでもいくつもIssueがたっていたり、日本語の記事もありましたがどれもうまく動きませんでした。

しかし、以下の対応でついにうまく動きました!!! :joy:
(Ubuntu 18.04です。)

git.bat
@echo off
wsl wslpath -aw $(git %*) 2> nul 
if not %errorlevel% == 0 (
    wsl git %*
)
@echo on
settings.json
{
    "git.path": "C:\\Tools\\git.bat"
}

image.png

参考

9
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?