[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Git snafu
From: |
Jim Porter |
Subject: |
Re: Git snafu |
Date: |
Mon, 1 May 2023 09:44:09 -0700 |
On 5/1/2023 5:44 AM, Eli Zaretskii wrote:
Date: Sun, 30 Apr 2023 14:13:50 -0700
From: Jim Porter <jporterbugs@gmail.com>
Cc: eliz@gnu.org
In fact, we can do something even simpler than that: just set the config
option "user.useConfigOnly" to true. See attached. Does this look ok to
everyone?
How do we know no one is using several email accounts, and would like
to avoid the annoyance of being prompted by Git?
I *do* use several email accounts, and this setting works properly for
me. My normal configuration is to have something like this in my
~/.gitconfig (repeated for a few other directories):
# Set user info for repos inside ~/src
[includeIf "gitdir:~/src/"]
path = ~/src/.gitconfig
Then, in my Emacs clone, I override my email address again (to this
one). With this combination of settings, everything works exactly as
expected with "user.useConfigOnly" set.
I can also set the author of a single commit via "git commit --author"
with "user.useConfigOnly" set (so that option is arguably a bit of a
misnomer; from reading the documentation[1], it really only means "don't
guess the user information").
Similarly, if I wanted to set the *committer*, I could use:
git -c user.name=Foo -c user.email=foo@example.com commit ...
The only time a *new* error occurs (that I can see, anyway) is if you
completely skip configuring your user info *anywhere*. Then, "git
commit" or "git commit --author" will fail (the latter fails because Git
still had to guess the *committer*). In this case, you can just use "git
-c user.name ..." as described above, and all is well.
All that said, I agree that this problem is a rare enough circumstance
that we probably don't really *need* to make my suggested change. I
think it's a low-risk change, but I won't be upset if we just leave
things as they are.
[1]
https://git-scm.com/docs/git-config#Documentation/git-config.txt-useruseConfigOnly
- Re: Git snafu, Eli Zaretskii, 2023/05/01
- Re: Git snafu,
Jim Porter <=