Certificate identity appears more than once in the keychain

Certificate identity 'Here comes your identity' 
appears more than once in the keychain. 
The codesign tool requires there only be one.

This bug made me spent like an hour in front of XCode and Apple Developer portal. In my case, the solution was to remove any conflicting certificates that have the same name. Basically, open Keychain Access, locate all the certificates with the name specified by the message, and remove ones that are not bound to XCode. Before removing them, make sure to backup certificates somewhere.