I had the same problem in Xcode 11.5 after revoking a certificate through Apple's developer homepage and adding it again (even though it looked different afterwards):
Every time I tried to archive my app, it would fail at the very end (not the pods but my actual app) with the same `PhaseScriptExecution failed with a nonzero exit code` error message. There is/was a valid team with an "Apple Development" signing certificate in "Signing & Capabilities" (project file in Xcode) and locking & unlocking the keychain, cleaning & building the project, restarting,... didn't work.
The problem was caused by having two active certificates of the same type that I must have added on accident, in addition to the renewed one. I deleted both the renewed one and the duplicate and it worked again.
You can find your certificates [here][1] or find the page like this:
-
[To see links please register here]
- "Account" (at the top)
- Log in
- "Certificates, IDs & Profiles" (on the left)
Also check that there aren't any duplicates in your keychain! Be careful though - don't delete or add anything unless you know what you're doing, otherwise you might create a huge mess!
[1]:
[To see links please register here]