I am aware that there are similar issues about git relating to the \'unable to unlink\' warning, but I have not been able to use them.
The main difference is that th
This can also occur when:
You ran a process inside a Docker container, and:
Some files were generated by that process, and:
The destination of the files is mounted as a volume on the Docker host, and:
You are running git on the Docker host.
If this is the case, stage the files you wish to commit and run:
git diff --name-only --cached | xargs ls -l
Files which meet the above criteria will be prefixed with:
-rw-r--r-- 1 root root ...
They are owned by root and not writable, which is not good.
To fix that run:
git diff --name-only --cached | xargs -i sh -c 'sudo chown $USER:$USER {}; chmod +w {}'
A cleaner solution would probably be to use the --user option, see this for Docker and this for Docker compose.