简体   繁体   中英

git commit ignoring email in global config and using hostname instead

I have an issue similar to this where my laptop was using me<my_emal> for commits, laptop catastrophically died, got new laptop, reinstalled Wheezy, stuck old drive in new laptop and my commits now use me<local_hostname>

My git config has the entries

[user]
name = me
email = myemail

I have tried the command

print_env

but GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL are not set.

Of the suggested commands

git config --system -l
git config --global -l
git config --local -l

only --global has user.name and user.email set and it is correct, --system reports /etc/gitconfig does not exist and --local has no entries for user* ie no user/email entries in my-repo/.git/config only in ~/.gitconfig .

 grep -R GIT_AUTHOR_EMAIL / 2>/dev/null

returns a bunch of results but does not explicitly set it to hostname

As a result this now breaks my building using git-buildpackage as the key to use is me<my_email> not me<hostname> .

I also spotted this on the package building side (which led me to the above post) but that's only for after the commit.

Running out of ideas now.

Setting null string in local repository is not valid

Hi, my case was your special case. (Please be tolerant if this answer was not you intended.)

Prerequisite

(OS X 10.10.5, git version 2.5.4 (Apple Git-61)/git version 2.7.0 from Homebrew)

Settings

The local repository had only null string like bellow! In this case, GIT_AUTHOR_IDENT set to `id -F`<`logname`@`hostname`> (I thought old git version 1.9 or so was effective with this configuration though)

localrepo/.config

[user]
name = ""
email = ""

$HOME/.config

[user]
name = me
email = myemail

Intention

I didn't want to log user.email. and user.name.

Maybe what you said

no entries for user* ie no user/email entries in my-repo/.git/config only in ~/.gitconfig

is actually like above?

Solution

localrepo/.config

[user]
name = " "
email = " "

A space was effective to achieve my intention.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM