git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Bug report: GIT_CONFIG and user.email/name
@ 2021-07-14 17:10 German Lashevich
  2021-07-14 18:10 ` Jeff King
  0 siblings, 1 reply; 16+ messages in thread
From: German Lashevich @ 2021-07-14 17:10 UTC (permalink / raw)
  To: git@vger.kernel.org

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-07-20 21:56 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-14 17:10 Bug report: GIT_CONFIG and user.email/name German Lashevich
2021-07-14 18:10 ` 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

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).