Preconfigure git user information from Che user's profile/preferences
See original GitHub issueIs your enhancement related to a problem? Please describe.
When the user is performing a git commit
through a terminal on a container or through the vscode extension, email and name are not configured.
At the moment, the user has to run these commands on the right git containers each time a new workspace is started.
git config --global user.name "John Doe" && git config --global user.email "john.doe@acme.com"
Describe the solution you’d like
If it was resolved in Che-theia, it will be good to get them from /api/preferences
.
Few ideas for fixing it:
- Retrieve defaults one from the che user api.
- Store name/email in preferences.
- Execute the previous commands on each containers (hard to predict where git is available or not, commands may fail)
- Add these env variables on each containers (don’t need git to be present, won’t crash) https://git-scm.com/book/pl/v2/Git-Internals-Environment-Variables
GIT_AUTHOR_NAME is the human-readable name in the “author” field. GIT_AUTHOR_EMAIL is the email for the “author” field. GIT_COMMITTER_NAME sets the human name for the “committer” field. GIT_COMMITTER_EMAIL is the email address for the “committer” field.
- Use EMAIL env variable
EMAIL is the fallback email address in case the user.email configuration value isn’t set. If this isn’t set, Git falls back to the system user and host names.
- Store/mount ~/.gitconfig in preferences (but where to mount them ? as
$HOME
maybe different is moving from one container to another)
Describe alternatives you’ve considered
If it was resolved in deployments, it will be good to create configmap and to mount /etc/gitconfig
.
Additional context
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (11 by maintainers)
Top GitHub Comments
Hi @monaka ! Thanks for raising this issue. @sunix also raised the same concern here: https://github.com/eclipse/che/issues/13880. I’m going to close the issue https://github.com/eclipse/che/issues/13880 and add the information from the issue in this enhancement request.
@vzhukovskii sorry i removed my comments because i wanted to double check first