VSCode 1.102.0 / devcontainer で発生することを確認した.
devcontainer内でgit
コマンドを容易に使えるようにするための親切挙動ではあるのだが, 私は困ったので回避方法を書き残しておく.
結論
devcontainer.json
で下記のように workspaceMount を明示すれば回避できる.
{
"workspaceMount": "source=${localWorkspaceFolder},target=${containerWorkspaceFolder},type=bind,consistency=cached",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}"
}
参考文献
If you add the
image
ordockerFile
properties todevcontainer.json
, VS Code will automatically "bind" mount your current workspace folder into the container. Ifgit
is present on the host'sPATH
and the folder containing.devcontainer/devcontainer.json
is within agit
repository, the current workspace mounted will be the root of the repository.
Ifgit
is not present on the host'sPATH
, the current workspace mounted will be the folder containing.devcontainer/devcontainer.json
.