'Copying local git config into docker container

I'm using both docker and docker-compose to host what for the most part is a LAMP stack. I'd like to be able to use git inside one of my containers without it asking for my user.email and user.name on push after I build. Along with other things such as my push.default and branch settings. Is there any good way to have docker or docker-compose copy the results of git config --list to a file in the container, which I can then use with my entrypoint to setup the git config.



Solution 1:[1]

For the docker-compose, this worked well for me (based on @atline's answer)

    volumes:
  - "~/.gitconfig:/etc/gitconfig"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Slava.In