this question is identical to Is there a way to get git to work properly from within a dev container using VS Code? but unfortunately, that post was marked as solved due to a fix in Docker. I have a more current version of Docker and VS Code as reported with the fix and am having this issue, which leads me to think that it's something else.
The problem: I'm prompted that I don't have git installed and my understanding is that I don't have to install a separate git within the image but can use the one on my host machine. Unfortunately, vs code is unable to detect it. My workaround is to disconnect from the dev container and then run my git operations but I'd rather not go through that.
My version of Docker is Docker version 20.10.1, build 831ebeae96 and VS Code is 1.52.1 on Linux.
My dockerfile is:
FROM ubuntu:latest
RUN apt-get -y update && apt-get install -y
RUN apt-get -y install clang
COPY . /usr/src
WORKDIR /usr/src
and my devcontainer.json is
{
"name": "Existing Dockerfile",
"dockerFile": "../Dockerfile",
"settings": {
"terminal.integrated.shell.linux": null,
"git.path": "/usr/bin/git", // added by me, tried without this line as well
},
}