git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: German Lashevich <german.lashevich@gmail.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Bug report: GIT_CONFIG and user.email/name
Date: Wed, 14 Jul 2021 19:10:27 +0200	[thread overview]
Message-ID: <1C6C1E49-5EC1-420D-A72A-8C50BD1931A2@getmailspring.com> (raw)

Hello,

I've faced an issue while trying to use a non-default .gitconfig file
via specifying
GIT_CONFIG environment variable.


What did you do before the bug happened? (Steps to reproduce your issue)

```
# use custom .gitconfig via GIT_CONFIG envvar:
mkdir -p /tmp/git-test/repo
cat <<EOT > /tmp/git-test/.gitconfig
[user]
    name = John Doe
    email = john@doe.me
EOT
cd /tmp/git-test/repo
git init
export GIT_CONFIG=/tmp/git-test/.gitconfig
echo Hi > readme.txt
git add readme.txt
git commit -m 'Initial commit'
```


What did you expect to happen? (Expected behavior)
Git creates a new commit.


What happened instead? (Actual behavior)
Error occurred:

```
Author identity unknown

*** Please tell me who you are.

Run

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

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'john@computer.(none)')
```


What's different between what you expected and what actually happened?
For some reason `git commit` doesn't use configuration options specified
in the
custom `.gitconfig` file.


Anything else you want to add:
`git config` shows correct values:

```
sh-5.1$ pwd
/tmp/git-test/repo
sh-5.1$ echo $GIT_CONFIG
/tmp/git-test/.gitconfig
sh-5.1$ cat $GIT_CONFIG
[user]
    name = John Doe
    email = john@doe.me
sh-5.1$ git config user.name
John Doe
sh-5.1$ git config user.email
john@doe.me
```

The same happens with git version 2.32.0.432.gabb21c7263


[System Info]
git version:
git version 2.32.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 5.12.15-arch1-1 #1 SMP PREEMPT Wed, 07 Jul 2021 23:35:29
+0000 x86_64
compiler info: gnuc: 11.1
libc info: glibc: 2.33
$SHELL (typically, interactive shell): /bin/zsh

             reply	other threads:[~2021-07-14 17:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14 17:10 German Lashevich [this message]
2021-07-14 18:10 ` Bug report: GIT_CONFIG and user.email/name Jeff King
2021-07-14 18:26   ` German Lashevich
2021-07-14 20:47   ` Junio C Hamano
2021-07-14 21:36     ` Jeff King
2021-07-14 21:37       ` [PATCH 1/3] doc/git-config: explain --file instead of referring to GIT_CONFIG Jeff King
2021-07-14 22:20         ` Taylor Blau
2021-07-14 22:23           ` Jeff King
2021-07-14 22:26             ` Taylor Blau
2021-07-20 19:34         ` Martin Ågren
2021-07-20 20:01           ` Jeff King
2021-07-20 20:03             ` Jeff King
2021-07-20 21:55             ` Junio C Hamano
2021-07-14 21:38       ` [PATCH 2/3] doc/git-config: clarify GIT_CONFIG environment variable Jeff King
2021-07-14 21:38       ` [PATCH 3/3] doc/git-config: simplify "override" advice for FILES section Jeff King
2021-07-14 22:22       ` Bug report: GIT_CONFIG and user.email/name Taylor Blau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1C6C1E49-5EC1-420D-A72A-8C50BD1931A2@getmailspring.com \
    --to=german.lashevich@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).