Fastlane Match: manually updating the git repo

There have been a couple of times where I wanted to replace a signing certificate in use with one of our apps.
For example, a certificate is expiring soon, and I want to create a new one and seamlessly transfer to the new certificate without orphaning app installs still using the old certificate.

Your only option via fastlane is to fastlane nuke and start over. But this removes everything, and invalidates the signing of your existing installed apps. [To be fair, this is only for enterprise deployments, i.e. non-app store.]

After creating a new certificate and provisioning profile pair in the Apple Developer Portal, you can then follow the steps below to get them in the match git repo so they will get picked up by fastlane match, while the old certificate and profile are still valid on the Developer Portal.

  1. Run irb in the terminal, followed by these commands:
  2. require 'match'
  3. git_url = '<github url>'
  4. workspace = Match::GitHelper.clone(git_url, false)
  5. Open the workspace directory reported by the previous command in Finder.
  6. In the certs folder, replace the .cer and .p12 files with the new versions.
  7. In the profiles folder, replace the provisioning profile.
  8. Back in the irb console, run Match::GitHelper.commit_changes(workspace, "manual profile update", git_url)

That's it.