Score:0

Dot gitconfig file not reflecting when switch user on ubuntu 22.04 lts

ru flag

Today I have installed Ubuntu22.04LTS. In that, i had a user bob and his git config is like

user.name=Bob B
[email protected]
alias.unadd=reset HEAD

I Had another user named quealy . when i switched to the user quealy. using sudo -s -u quealy the bob gitconfig setting not reflecting.

Previously, I encountered a similar issue on Ubuntu 20.04 LTS. However, I was able to resolve it by creating and adding the following configuration.

sudo visudo -f /etc/sudoers.d/keep-home with Defaults    env_keep += "HOME"

I followed the same but not working in Ubuntu22.04LTS

Score:1
es flag

Git doesn't care what your system user name (as displayed by echo $USER) is, it only cares about what you configured in ~/.gitconfig or in your project's .git/config files.

So if you wish to work with several different user names (or more precisely Git committer names) for different Git projects, you need to set up different users with different home directories for each of them.

Alternatively, which I find much easier and better maintainable, simply edit the .git/config file for each of the projects where you want a different name; add a section

[user]
        name = Joe Hacker
        email = [email protected]

Notice that a value in the project's .git/config file overrides that same value in ~/.gitconfig.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.