git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-gui: Warn when username and e-mail address is unconfigured?

From
JRJeremy Ramer <jdramer@gmail.com>
Date
Dec 4, 2008, 23:58 UTC
Message-ID
<b9fd99020812041558w204e5f48gbed73fdbd289ad@mail.gmail.com>
In-Reply-To
<7vskp3d3q9.fsf@gitster.siamese.dyndns.org>
On Thu, Dec 4, 2008 at 2:34 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 31 quoted lines
> "Jeremy Ramer" <jdramer@gmail.com> writes:
>
>> On Thu, Dec 4, 2008 at 12:04 PM, Sverre Rabbelier <alturin@gmail.com> wrote:
>>> On Thu, Dec 4, 2008 at 17:05, Jeremy Ramer <jdramer@gmail.com> wrote:
>>>> That's strange. I am using git 1.6.0.4 on cygwin and I get a warning
>>>> message every time I start git gui.  I actually find this really
>>>> annoying and would like a way to turn this warning message off.
>>>
>>> git config --global user.name "Your Name"
>>> git config --global user.email "you@example.com"
>>>
>>
>> I have done that.  I still get the warning message every time I start git gui.
>
> I do not use Windows, and I do not run git-gui, so I am guessing only from
> the source.  Are you talking about the message composed by this part?
>
>    # -- Warn the user about environmental problems.  Cygwin's Tcl
>    #    does *not* pass its env array onto any processes it spawns.
>    #    This means that git processes get none of our environment.
>    #
>    if {[is_Cygwin]} {
>            set ignored_env 0
>            set suggest_user {}
>            set msg [mc "Possible environment issues exist.
>
>    The following environment variables are probably
>    going to be ignored by any Git subprocess run
>    by %s:
>
>    " [appname]]
Yes, that does appear to be the message I get, with the following
environment variables:
- GIT_AUTHOR_EMAIL
- GIT_COMMITTER_NAME
- GIT_COMMITER_EMAIL
- GIT_AUTHOR_NAME

Now that I look closer I see that I am setting these in my .bashrc file. When I first started using git a year ago I was given the impression that these were needed. But I see that that is no longer the case since I use the config:

git config --global user.name "Your Name" git config --global user.email "you@example.com"

Removing them from my .bashrc removes the warning. In hindsight the warning should have clued me in, but I've been seeing that message since I first started using git on Cygwin so I figured it was a cygwin issue that I couldn't do anything about.

Show 40 quoted lines
>
> The logic to produce the error message does look somewhat screwy.
>
> It checks a selected set of variables whose name begin with GIT_ in the
> environment, and if it finds any, it gives the above message.  In
> addition, if GIT_{AUTHOR,COMMITTER}_{EMAIL,NAME} are among them, it also
> adds this to the message:
>
>                    if {$suggest_user ne {}} {
>                            append msg [mc "
>    A good replacement for %s
>    is placing values for the user.name and
>    user.email settings into your personal
>    ~/.gitconfig file.
>    " $suggest_user]
>
> There are two and half issues about this code.
>
>  (1) When it prepares additional message about user.{email,name},
>     it does not check if the user already has them defined.  IOW, there
>     is no way other than unsetenv before running git-gui to squelch this
>     part of the message.
>
>  (2) For other environment variables, such as GIT_PAGER, it does not offer
>     alternatives, such as core.pager.  Again, there is no way other than
>     unsetenv to squelch the warning.
>
> An excuse to both of the above could be that the warning is not about the
> user having environment variables that can be discarded, but about
> brokenness of Cygwin Tcl envirnonment that discards them.  But if that is
> the case, there is this other half issue:
>
>  (3) The warning does not trigger if the environment is not set when this
>     check is made.  Now I do not know if git-gui tries to spawn
>     subprocesses with its own (customized) environment settings (e.g. you
>     would need to be able to run git-commit-tree with modified
>     GIT_AUTHOR_NAME if you want to use the lowlevel plumbing to create a
>     new commit and lie about the author identity), but if it does, the
>     warning does not trigger.
>
I agree that the logic could using improvement.
Previous: Junio C HamanoNext: Alexander Gavrilov
Message 7 of 10 in “git-gui: Warn when username and e-mail address is unconfigured?”
  1. Peter KreftingDec 4, 2008
  2. Jeremy RamerDec 4, 2008
  3. Sverre RabbelierDec 4, 2008
  4. Jeremy RamerDec 4, 2008
  5. Alexander GavrilovDec 4, 2008
  6. Junio C HamanoDec 4, 2008
  7. Jeremy RamerDec 4, 2008
  8. Alexander GavrilovDec 5, 2008
  9. Jeremy RamerDec 5, 2008
  10. jidanni@jidanni.orgDec 12, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.