ADo repository: The push was rejected because commits contain author email which does not match the policy-specified patterns
Asked Answered
N

4

12

I'm trying to push commits from my GitHub repository to an ADO repository. The commits in GitHub repository are added by myself and some other authors. On pushing commits to my remote branch in ADO repository, I see this error:

VS403702: The push was rejected because one or more commits contain author email '[email protected]' which does not match the policy-specified patterns.

Is there a way to fix this issue?

Nimmons answered 1/12, 2020 at 0:28 Comment(2)
Your repository's email policy doesn't like your email. Change your email, or change the policy.Fathomless
In order to introduce third-party commits, the hosting service is supposed to have a configuration item that allows a user to bypass the email verification.Swithbert
M
11

You can go to Project Settings -> Repositories -> Select the repository that you want to push -> Policies -> Repository Policies/Commit author email validation to check whether its settings conflict with your email address.

The settings may be inherited from the project. Go to Project Settings -> Repositories -> Policies -> Repository Policies/Commit author email validation to see the settings for the entire project.

{picture}

Morph answered 1/12, 2020 at 3:7 Comment(1)
Thank you! It looks like I don't have the permission to disable this policy. Is there a way to get an exception to push commits from external domains?Nimmons
S
22

Well, in such scenarios we need to change author email with the authorized email in the commits for which your repo doesn't allow to push.

$ git config user.email [email protected]
$ git commit --amend --reset-author

As pointed out in the below comment. we need to add --no-edit at the end.

$ git commit --amend --reset-author --no-edit
Sauropod answered 6/12, 2021 at 11:10 Comment(1)
I had to use --no-edit at the end to get it work for me. ie: $ git commit --amend --reset-author --no-editKoblick
M
11

You can go to Project Settings -> Repositories -> Select the repository that you want to push -> Policies -> Repository Policies/Commit author email validation to check whether its settings conflict with your email address.

The settings may be inherited from the project. Go to Project Settings -> Repositories -> Policies -> Repository Policies/Commit author email validation to see the settings for the entire project.

{picture}

Morph answered 1/12, 2020 at 3:7 Comment(1)
Thank you! It looks like I don't have the permission to disable this policy. Is there a way to get an exception to push commits from external domains?Nimmons
D
0

In my case I Dropped the local commit and checkout to Remote branch, thenafter I merged it with other updated branch and pushed. worked fine

Dragoman answered 19/10, 2023 at 11:53 Comment(0)
F
-1

If you do not have access to change the policy you can still commit the code after changing your email in git config:

git config user.email "[email protected]"

and reset the commits which contains emails that are not allowed, and then commit again with the updated email.

Falsity answered 2/11, 2021 at 9:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.