Repository: vscode
Issue: Git - VScode force changes the locale to en_US.UTF-8 for git commit hooks in dev-container
Labels: bug,git

<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: Yes/No -> Cannot disable all extensions because WSL and Dev-Container is required to reproduce.

<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->
- VS Code Version: 1.80.1
- OS Version: Windows 11 22H2 -> WSL Debian 12 Bookworm/podman -> python:3.11-slim-bullseye base Container

Steps to Reproduce:

1. Use python:3.11-slim-bullseye as a base container and install git.
2. Create a pre-commit hook that echos the locale.

You will observe, that the container uses C.UTF-8 which is fine. But when the vscode extension host triggers git which starts the pre-commit hook script, it seems to force `en_US.UTF-8` which is not even installed in the container.

I already tried setting `"terminal.integrated.detectLocale": "off"` with no effect.

## Example

When using the integrated terminal (inside the dev container) you get the following result:
```shell
 root $ /workspaces/testrepo # git -c user.useConfigOnly=true commit --quiet 
+ locale -a
C
C.UTF-8
POSIX
+ locale
LANG=C.UTF-8
LANGUAGE=
LC_CTYPE="C.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_TIME="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_MESSAGES="C.UTF-8"
LC_PAPER="C.UTF-8"
LC_NAME="C.UTF-8"
LC_ADDRESS="C.UTF-8"
LC_TELEPHONE="C.UTF-8"
LC_MEASUREMENT="C.UTF-8"
LC_IDENTIFICATION="C.UTF-8"
LC_ALL=
+ INSTALL_PYTHON=/usr/local/bin/python3
+ ARGS=(hook-impl --config=.pre-commit-config.yaml --hook-type=pre-commit)
...
```

When using the UI and trying to commit, my pre-commit hooks fail with the following output:
```shell
> git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
+ locale -a
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
C
C.UTF-8
POSIX
+ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8
+ INSTALL_PYTHON=/usr/local/bin/python3
+ ARGS=(hook-impl --config=.pre-commit-config.yaml --hook-type=pre-commit)
```