(local) $ git config --global user.email "[email protected]"
(local) $ git config --global user.name "Your Name"
Remote-Container: rebuild Container
Git commit
(Remote-Container) $ git commit -m hogehoge
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'root@aaaaaaaaaaa.(none)')
https://code.visualstudio.com/docs/remote/containers#_sharing-git-credentials-with-your-container
I had a similar issue because I was running git config --global in postCreateCommand. I wanted to change the diff and merge tools in the container. However, my username and password disappeared from my .gitconfig. I did not understand the cause yet, but I solved the issue by adding my commands to the postAttachCommand instead.
So, in the .devcontainer/devcontainer.json, instead of:
{
...
postCreateCommand": "git config --global diff.tool ...",
...
}
I use:
{
...
postAttachCommand": "git config --global diff.tool ...",
...
}
I am wondering if your situation is not related. It should be useful to know your .devcontainer/devcontainer.json. Still, I hope this information is useful for other users with similar problems.
For me I was using WSL2 on Windows with devcontainers and found that it doesn't copy .gitconf from windows but from the base Linux distro so I had to add the settings there.
So in WSL terminal I did :
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
Then these settings were shared with the devcontainer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With