question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Preconfigure git user information from Che user's profile/preferences

See original GitHub issue

Is 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:

  1. Retrieve defaults one from the che user api.
  2. Store name/email in preferences.
  3. Execute the previous commands on each containers (hard to predict where git is available or not, commands may fail)
  4. 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.

  5. 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.

  6. 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

Screenshot 2019-07-17 at 15 07 52

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
slemeurcommented, Jul 17, 2019

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.

0reactions
sunixcommented, Sep 4, 2019

@vzhukovskii sorry i removed my comments because i wanted to double check first

Read more comments on GitHub >

github_iconTop Results From Across the Web

1.6 Getting Started - First-Time Git Setup
If you want to check your configuration settings, you can use the git config --list command to list all the settings Git can...
Read more >
How to Configure Git Username and Email Address - Linuxize
The first thing you should do after installing Git on your system is to configure your git username and email address. Git associate...
Read more >
How set git config username and email fields in global and ...
Git allows you to set variables at the system, global, local and workingtree level. If you want to use a special name or...
Read more >
git config | Atlassian Git Tutorial
The git config command is a convenience function that is used to set Git configuration ... and Settings\All Users\Application Data\Git\config on Windows XP, ......
Read more >
Can I specify multiple users for myself in .gitconfig?
git config user.name "Your Name Here" git config user.email your@email.com ... post I wrote a pre-commit hook (resides in ~/.git/templates/hooks ) which ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found