8

I want to disable the option for my git users that they can set a global username and email. I want it to be empty at all.

Now I have the problem, that when some of them set the global user.name and global user.email, all the commited codes goes by the same name in every project.

How can I solve this problem?

2
  • Could you describe how users create their commit ? For example : is it from their own machine ? or do they connect to a shared server and commit from there ? Commented Jul 22, 2020 at 7:24
  • @LeGEC they commit from their own machine Commented Jul 23, 2020 at 5:59

1 Answer 1

9

Global options are for each user to set (or not)

You would need for them to use, as in here:

git config --global user.useConfigOnly true 

Any new repo will look for user.email only in their local .git/config file.
And the commit will not proceed if no user.email is found in the local git config.

That helps force the user define their identity in each of their repositories.

Sign up to request clarification or add additional context in comments.

5 Comments

i now managed it with ssh connection, this problem occurs when they use the http.
can they still set or unset the global config settings, specially the global user.name and user.email ?
@arashyousefi user.name/email config have nothing to do wth authentication though.
i know it but the global user.name will be set for all committed codes. no matter what the authentication info is.
@arashyousefi I agree. But that will happen whether they use SSH or HTTPS. With the setting I propose, they will have to set explicitly their user.name/email per repository, not globally.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.