I'am currently converting a svn repository into a git one. As I proceed manually, I regularly change the user.name and user.email to set the author of the commit. Everythin开发者_JS百科g seems to work fine, but now I have to commit something from a user which has no email address. I removed email property from .gitconfig file and tried, but then in git log, email field shows user_login@user_login.(none)
. Is it possible to set no email and prevent git guessing one ?
I think that you can only do this with an explicit author specification:
git commit --author "Snail Mail <>"
You need the angle brackets so that git knows that you really are passing an empty email address.
Similar to neodelphi's comment, you can set this for all commits with
git config --global user.name 'Snail Mail'
git config --global user.email '<>'
(You can use quotes instead of escaping.) To set this for the current project only, remove the --global
option only. i.e.
git config user.name 'Snail Mail'
git config user.email '<>'
Use GitHub Anonymous NoReply Email (recommended)
When contributing to github, always use the anonymous noreply email address provided by github - which you can find here: https://github.com/settings/emails (have to tick "Keep my email addresses private" to see it).
Read more here: https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-user-account/managing-email-preferences/setting-your-commit-email-address
If using github or even if you're not, this is a better option than setting no email.
git config user.name 'Joe Blogs'
git config user.email 'ID+username@users.noreply.github.com'
Or you can add this to your ${repo}/.git/config
or .gitconfig
file directly;
[user]
name = Joe Blogs
email = ID+username@users.noreply.github.com
Set invalid email (not recommended)
Otherwise you can fallback to the other options people have stated;
git config user.name 'Joe Blogs'
git config user.email '<>'
Or you can add this to your ${repo}/.git/config
or .gitconfig
file directly;
[user]
name = Joe Blogs
email = <>
I had same issue . But now I can fix it by using github no reply mail .
Go to https://github.com/settings/email and copy your no reply mail ,it would look like this ID+username@users.noreply.github.com
.
than set this email as global email to your pc :
git config user.email 'ID+username@users.noreply.github.com
After this process your problem will fix
精彩评论