LoginSignup
14
25

More than 5 years have passed since last update.

Visual Studio Code の統合ターミナルと Git を Windows Subsystem for Linux のものに指定する

Last updated at Posted at 2018-07-28

概要

Windows 10 環境において、Visual Studio Code の統合ターミナルを WSL (Windows Subsystem for Linux) の Bash を使うようにし、Git も WSL 上にインストールされた Git を使うようにするための設定方法です。

方法

手順

  1. WSL(今回は Ubuntu)をインストールします。
  2. WSLGit の releases ページから最新バージョンの wslgit.exe をダウンロードします。
  3. Visual Studio Code の設定ファイルに以下の内容を記述します(ユーザー設定・ワークスペースの設定のどちらか)。
  4. Visual Studio Code を再起動して完了です。
{
    "git.path": "C:\\path\\to\\wslgit.exe",
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\bash.exe",
    "terminal.integrated.shellArgs.windows": [
        "~",
        "--login"
    ]
}

設定項目について

git.path

wslgit.exe のパスを指定します。

terminal.integrated.shell.windows

統合ターミナルに何を使うかを指定します。

今回は WSL 上の Bash を使うために bash.exe を指定します。

terminal.integrated.shellArgs.windows

ターミナルを起動するときの引数を配列で指定します。

  • ~: ターミナル起動時にホームディレクトリを開きます。
  • --login: ターミナル起動時に~/.bash_profile~/.bashrc を読み込みます。

以上です。おつかれさまでした。

14
25
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
14
25