My goal is to make the global git config name
and email
empty. I can do that, but after a while it gets reset to an old email I don't use anymore.
I'm not sure why or how my /home/<user>/.gitconfig
changes, but it does without my awareness.
I'm on Ubuntu 18.04, git 2.17.1.
Does anyone know how I can find what is changing my global config file and/or how I can prevent it from changing?
My global config settings if it's of any help (how I want it to be). Notice how the [user]
group is empty:
[core]
editor = nano
pager = less -x1,5
[push]
default = simple
[merge]
tool = meld
[mergetool "meld"]
path = /usr/bin/meld
[mergetool]
prompt = false
[alias]
adog2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar$
adog = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C($
co = checkout
s = status
u = reset HEAD --
last = log -1 HEAD
st = status
unstage = reset
[user]
This is how it becomes after a while (the name and email values are not real in this example):
[core]
editor = nano
pager = less -x1,5
[push]
default = simple
[merge]
tool = meld
[mergetool "meld"]
path = /usr/bin/meld
[mergetool]
prompt = false
[alias]
adog2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar$
adog = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C($
co = checkout
s = status
u = reset HEAD --
last = log -1 HEAD
st = status
unstage = reset
[user]
name = Some Fake Name
email = [email protected]
And before anyone asks, I remove my global git config name and email so that when I clone new repos git asks explicitly for a user and email for that repo. This helps me to manage work and personal git accounts.
I managed to find the cause by setting up auditctl to monitor my global gitconfig file.
I set up -w /home/<user>/.gitconfig -p rwa -k gitconfig
as a rule and read the logs with ausearch -k gitconfig --format text
. Then I noticed this:
At 13:30:35 25/07/2022 <user> successfully opened-file /home/<user>/.gitconfig using /usr/share/atom/resources/app.asar.unpacked/node_modules/dugite/git/bin/git
.
Then I successfully managed to reproduce this. Every time I opened a repository with Atom, Atom rewrote my global .gitconfig file.
It turns out the problem was Atom's github integration: https://github.com/atom/github/issues/2557. And that got solved in https://github.com/atom/github/pull/2587. I upgraded Atom to 1.60.0 and it fixed the issue.
Thanks @torek, for informing me this wasn't an expected behavior in my platform. And thanks @jthill, for giving me the idea to monitor the files changes.