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?

4

There are 4 best solutions below

1
On BEST ANSWER

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}

0
On

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

1
On

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
0
On

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.