有没有办法让 git 在使用 VS Code 的开发容器中正常工作?

mic*_*ael 10 git containers visual-studio-code vscode-remote

我正在使用VS Code并安装了Remote Development扩展程序。我devcontainer为我的 Angular 应用程序创建了一个。到目前为止,一切正常。该Dockerfiledevcontainer.json文件是非常简单的:

Dockerfile:

FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-12
Run Code Online (Sandbox Code Playgroud)

devcontainer.json

{
    "name": "Angular App",
    "dockerFile": "Dockerfile",
    "settings": { 
        "git.path": "/usr/bin/git",
        "terminal.integrated.shell.linux": "/bin/bash"
    },
    "extensions": [
        "angular.ng-template",
        "natewallace.angular2-inline",
        "dbaeumer.vscode-eslint"
    ],
    "forwardPorts": [4200, 9876],
    "mounts": [ ],
    "remoteEnv": { },
    "postCreateCommand": "yarn install",
}
Run Code Online (Sandbox Code Playgroud)

在我的容器之外,我的 git 路径位于C:\Program Files\...目录中。在我的容器中,git 路径是/usr/bin/git,这就是我设置"git.path"属性的原因,我通过使用which git容器内的命令验证了这一点。当然,任何 git 命令都不起作用,因为它们总是会导致错误。

致命:无法 chdir 到“C:/Workspace/my-angular-app”:没有这样的文件或目录

我总是可以使用该Remote-Containers: Reopen Locally命令,一旦我回到 Windows(容器外),我的源代码控制就会亮起我所有的差异,并且 git 工作得很好。但是,如果有办法让 git 在容器内工作,那将会很有帮助。我不想在处理更改时经常退出容器来识别差异。

mic*_*ael 0

此问题已解决,但最初是 Docker 问题:https ://github.com/microsoft/vscode-remote-release/issues/2591