LoginSignup
5
2

More than 3 years have passed since last update.

【Tips】VSCode Live Share で.gitignore に記述したファイルが共有されない

Posted at

開発のリアルタイム同期プラグインであるVisual Studio Code Live Share において、一部ファイルが共有されないことを確認。

ファイル同期されないのは[セッションホスト] -> [セッション参加者]の向き。

原因

デフォルトだと.gitignoreに記述したファイルを共有対象から除外される(セキュリティを考慮した作り)。

対処

これを無効化するにはセッションホスト側で以下のファイルをプロジェクトフォルダ直下に配置する

  • .vsls.json
{
    "$schema": "http://json.schemastore.org/vsls",
    "gitignore":"none"
}

なお.vsls.json自体はセッション参加側に共有されない様子。
その他にも特定のファイルやフォルダのみを除外したい、といったやり方も可能。

{
    "$schema": "http://json.schemastore.org/vsls",
    "gitignore":"none",
    "excludeFiles":[
        "*.p12",
        "*.cer",
        "token",
        ".gitignore"
    ],
    "hideFiles": [
        "bin",
        "obj"
    ]
}

参考: Security features of Live Share

5
2
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
5
2