It seems like Visual Studio Code and it's dev containers copy the .gitconfig upon creation. As I have to manage different identities I've quite an extensive .gitconfig, which load other configuration files conditionally. For example:
[includeIf "gitdir:~/Workspace/github.com/"]
path = .gitconfig-github.com
Of course Visual Studio Code doesn't copy them and even if it wouldn't work as the conditional doesn't apply because it will detect the wrong directory.
Anyhow, is it somehow possible to run git config --get user.name and git config --get user.email outside of the container within the working directory and set it to the devcontainer upon creation?
Update
The problem is it's not possible to retrieve the return values from commands within a docker-compose.yml or Dockerfile to hand it over to the container right?
version: '3'
services:
app:
build:
context: .
dockerfile: Dockerfile
args:
VARIANT: 14
GIT_USERNAME: ${git config --get user.name}
GIT_USERMAIL: ${git config --get user.email}
volumes:
- ..:/workspace:cached
command: sleep infinity
Something like this wouldn't work. Is there a workaround?