git push failed with the following message:
remote: GitLab: Author '`[email protected]`' is not a member of team
My #git config user.name and #git config user.email are set as:
#git config user.name
Sam Logan
#git config user.email
[email protected]
My hostname is logath-T460.
I am not sure why git push uses my localhostname with the Author. Any clue how to resolve this issue?
It's not git push
that's using your username + hostname, it's git commit
.
By default, if you did not set user.name
and user.email
BEFORE making a commit, git will get it from your computer name and hostname. It would also have shown you a warning like this:
Committer: user1234 <[email protected]>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email [email protected]
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 file1.txt
When you do git push
, it would just use whatever was set as the commit author and push it to the remote repo.
What I think happened, is that you already committed BEFORE you set the correct user.name
and user.email
settings. So those commits you're trying to push already has that invalid user details "[email protected]" saved as the commit author.
What you need to do then is to update the author of the previous commits.
First, make sure to properly set the user.name
and user.email
config (--global
or --local
to the repo), otherwise known as your Git identity.
git config --global user.name "yourname"
git config --global user.email "[email protected]"
Set it now to the correct identity that matches the user account of your Gitlab repo.
Then use --reset-author
on those commits.
git commit --amend --reset-author --no-edit
git rebase -i HEAD~N -x "git commit --amend --reset-author --no-edit"
where N
is the number of previous commits you need to update. The rebase -i
will show a command line editor to show you the changes, and --reset-author
will use your current user.*
settings. Just save and quit to apply to changes.After that, git push
should now work.
I had this issue while migrating a project to a new Gitlab site. The solution that worked for me was to disable the option "Check whether author is a GitLab user" in my new project.
From Gitlab docs:
GitLab already offers protected branches, but there are cases when you need some specific rules like preventing Git tag removal or enforcing a special format for commit messages.
Push rules are essentially pre-receive Git hooks
push rule "Check whether author is a GitLab user":
Restrict commits by author (email) to existing GitLab users.
If this is your initial commit (as in my case) you might want to deactivate the GitLab user check just once and re-activate it for future commits.
The option is available from Gitlab Starter 7.10 and can be edited in the Web interface in settings/repository
See also: How to bypass: remote: GitLab: Author is not a member of team?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With