1

I'm new to vscode + docker. I've followed some specific instructions to set up my vscode project by editing settings.json, devcontainer.json, docker-compose.yaml, etc., and I've managed to connect to a virtual machine, launch the web server on it and access it in my browser, to run SQL queries and terminal commands on this virtual machine from vscode. HOWEVER I cannot perform a git pull or commit.

To produce the problem:

  • Ctrl-Shift-P to pull up command window in vscode
  • select Git: Pull
  • an error dialog appears, saying Git: Host key verification failed.
  • click 'Show Command Output' and see the following:
> git pull --tags origin main
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I have searched for solutions and can't seem to solve the problem. I did stumble across this troubleshooting guide but much of it is greek to me. I did try running docker ps on my workstation, which is running Ubuntu 20.04 and my workstation recognize the commmand:

$ docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

If I run the same command on the virtual machine/container in vscode, it looks like the remote machine doesn't recognize the command:

$ docker ps
bash: docker: command not found

Any help would be much appreciated. I wonder if perhaps I might need to remove an entry from the known_hosts file on my workstation? Let me know if I need to provide more detail about the vs code configuration.

AEM
  • 1,354
  • 8
  • 20
  • 30
S. Imp
  • 2,833
  • 11
  • 24
  • Can you provide a link to the instructions you were following? It is unclear exactly what you are trying to achieve. – Derek Brown Jun 04 '21 at 22:29
  • @DerekBrown the instructions are lengthy and would need to be redacted. Suffice it to say that they specify how to add a key to the ssh-agent, and then add docker host & certs for the vscode project. I'm able to do everything I need in vs code except pull changes from the git repo or commit changes to the git repo. – S. Imp Jun 04 '21 at 22:36
  • Docker gives you a "virtual machine" of sorts (if you know the history of VM development you'll see how a BSD "jail" or Docker instance is kind of a low-budget version of a VM, but it's still a kind of VM). This virtual machine is *a different host*, with different commands, a different IP address (maybe—some VMs borrow more or less), etc., so it should be unsurprising if you can't run docker again *inside the VM*. Meanwhile, though, host key verification relies on data stored in a file system, and a lot of the point of docker or similar is to be able to *share* certain files. So [continued] – torek Jun 05 '21 at 03:10
  • [cont'd] you might want to make sure that the right files are being shared, and other files aren't, depending on what exactly you're trying to do. Host authentication can be complex and *Git itself does none of it* (because it *is* complicated). Git shoves it all off on helpers. If you're using https, you get one set of helpers; if you're using ssh, you get a different set; Linux, macOS, and Windows all have different OS-level helpers; and so on. You'll need to provide a lot more detail. – torek Jun 05 '21 at 03:12
  • It seems that ssh is not yet active. This question could help: https://stackoverflow.com/questions/3669001/getting-ssh-agent-to-work-with-git-run-from-windows-command-shell/15870387 – Constantin Konstantinidis Jun 05 '21 at 05:35

0 Answers0