Skip to content

Instantly share code, notes, and snippets.

@mourad-brahim
Last active January 2, 2019 13:11
Show Gist options
  • Save mourad-brahim/98712bbb46f9e032eebb1a1a32584760 to your computer and use it in GitHub Desktop.
Save mourad-brahim/98712bbb46f9e032eebb1a1a32584760 to your computer and use it in GitHub Desktop.
Add existing certificates and profiles to be used with match

Certificates:

1- Find the team identifier somewhere in Xcode or the Apple developer portal

2- Export the existing certificate from your keychain. Two files are needed; certificate.p12 and certificate.cer

3- The files exported on the 2nd step needs to be encrypted use the following commands to do that: openssl pkcs12 -nocerts -nodes -out key.pem -in certificate.p12 openssl aes-256-cbc -k your_password -in key.pem -out cert_id.p12 -a openssl aes-256-cbc -k your_password -in certificate.cer -out cert_id.cer -a => use the match password to encrypt these files

4- Rename the output of these commands (cert_id.p12 & cert_id.cer); use the team identifier found on step1 (new names should be: team_identifier.p12 and team_identifier.cer)

Provisionnings:

5- Download the provisionning profiles needed from the Apple developer portal

6- Encrypt these files using the openssl command with the same password used for the certificates openssl aes-256-cbc -k your_password -in provisionning.mobileprovision -out encrypted_provisionning.mobileprovision -a

7- Rename the output of the previous command; use the following rules Development_your.bundle.id.mobileprovision AdHoc_your.bundle.id.mobileprovision AppStore_your.bundle.id.mobileprovision InHouse_your.bundle.id.mobileprovision

Push the certificates to the git repository used with match: 9- On your local repository create a new branch (if needed). The name of the branch should be the name of the apple developer team. use the following steps: git checkout --orphan branch_name git rm -rf .

10- If the branch exists, just add the needed certificates folders: certs/development certs/enterprise certs/distribution

11- And add the needed profiles folders: profiles/development profiles/enterprise profiles/adhoc

12- Copy the certificates and provisionnings to the appropriate folders

13- Add files to git, commit and push to remote repository

14- Now you are able to install these certificates and provisionnings on new machines using fastlane match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment