Codesign error: Certificate identity appearing twice

前端 未结 15 2177
孤城傲影
孤城傲影 2020-12-07 13:04

CodeSign error: Certificate identity \'iPhone Developer: XXXX (12345678)\' appears more than once in the keychain. The codesign tool requires there only be one.

So I

15条回答
  •  不知归路
    2020-12-07 13:21

    Simply deleting the redundant certificate didn't work for me. It seems that every time xcodebuild is called, it is "Re-creating" the certificate in the keychain from a cache somewhere... same issue as avi I created a hack / fix for it, tried to find where the file was getting cached and clear it, but had not luck. In the end, what worked for me (a bit of a hack, but hey, what else can you do), was to figure out what the certificate number is, and manually remove it from the keychain shortly after xcodebuild is called. First, go to your /usr/bin/ directory (or whatever directory has your xcodebuild file, try which xcodebuild) and run the following command:

    sudo mv xcodebuild xcodebuild_actual
    

    Then create a file using your favorite editor (don't forget to sudo) with the following code:

    xcodebuild_actual $* &
    echo "xcodebuild started, waiting to wipe certificate, 10 seconds"
    sleep 2
    echo "Wiping Certificate..."
    sudo security -v delete-certificate -t -Z 407629F811D52C0BB7AD31BBB18DCB496354B05E
    

    Note: you'll have to modify your sudoers file to have access to run this specific command without having to enter a password.

    Replace the hex identity after -Z above with the hex identity of the offending zombie certificate. Finally, make sure that the xcodebuild file is executable:

    sudo chmod 755 xcodebuild 
    

    You can now open your keychain and run the build command, and watch how the offending zombie certificate is resurrected, and then summarily shotgunned prior to it becoming a problem for codesigning. Hopefully Apple will come up with a real fix for this.

提交回复
热议问题