When using Visual Studio Code (vscode) devcontainers the extension automatically sets vscode as the git editor. It does this by setting the GIT_EDITOR
env var.
To prove it, I ran:
docker run --rm mcr.microsoft.com/devcontainers/base:bookworm bin/bash -c 'echo ${GIT_EDITOR}'
which didn't return anything. To prove that it would return a value if it were set run
docker run --rm mcr.microsoft.com/devcontainers/base:bookworm bin/bash -c 'echo ${HOSTNAME}'
which will return a command (proving that my docker run
command is correct).
However, if I use that image for my devcontainer in .devcontainer/devcontainer.json:
{
"name": "Debian",
"image": "mcr.microsoft.com/devcontainers/base:bookworm"
}
and then inside the devcontainer run:
echo $GIT_EDITOR
it returns:
code --wait
Clearly the devcontainers extension is setting GIT_EDITOR
. However I don't want to use vscode to edit git messages, I prefer to use the command-line. How can I stop it from doing so? Obviously I can simply
unset GIT_EDITOR
but its rather tedious to do that over and over again. I wonder if there's a setting that I can set in devcontainer.json that prevents GIT_EDITOR
from getting set?