6

Git is not detected when I open dev container in VisualStudio Code even when I cloned the file from GitHub using SSH key.

Docker Desktop is working fine, also Everything is working fine as I can perform build, clean and test.
I cannot commit changes because there is not git repository.

No Git in DevContainer:
shows no git

Local filesystem with cloned files:
cloned file

I'm new to this. If anyone can help.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Devid Karki
  • 61
  • 1
  • 2
  • Which images is the devcontainer using? The devcontainer needs to have `git` installed. The terminal will only have access to programs installed in the container, not your host machine. That's kind of the whole point of the container. – MrFlick Jul 10 '22 at 19:36
  • 1
    Could you show us your devcontainer.json and the related Dockerfile? – ikhvjs Jul 11 '22 at 07:14

1 Answers1

3

Developping inside a container means you need to Open a Git repository or GitHub PR in an isolated container volume#, in order for your container filesystem to mount the right local folder (the one with a .git in it)

https://code.visualstudio.com/assets/docs/remote/containers/architecture-containers.png

Start VS Code and run Remote-Containers: Clone Repository in Container Volume... from the Command Palette (F1).

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250