No code signing identity found and can not create a new one because you enabled `readonly`

Viewed 1074

when I using fastlane to publish ios app in github:

- name: Deploy to TestFlight/PGY
        run: |
          cd ./ios
          bundle exec fastlane beta
        env:
          FLUTTER_ROOT: ${{ secrets.FLUTTER_ROOT }}
          APPLE_ID: ${{ secrets.APPLE_ID }}
          GIT_URL: ${{ secrets.GIT_URL }}
          PGY_USER_KEY: ${{ secrets.PGY_USER_KEY }}
          PGY_API_KEY: ${{ secrets.PGY_API_KEY }}
          TEAM_ID: ${{ secrets.TEAM_ID }}
          ITC_TEAM_ID: ${{ secrets.ITC_TEAM_ID }}
          FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
          FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
          FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }}
          FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }}
          MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
          MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
          MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}

shows this error:

No code signing identity found and can not create a new one because you enabled `readonly`

this is the part of the log:

+-----------------------+---------+--------+
|               Used plugins               |
+-----------------------+---------+--------+
| Plugin                | Version | Action |
+-----------------------+---------+--------+
| fastlane-plugin-pgyer | 0.2.2   | pgyer  |
+-----------------------+---------+--------+

[14:58:29]: Sending anonymous analytics information
[14:58:29]: Learn more at https://docs.fastlane.tools/#metrics
[14:58:29]: No personal or sensitive data is sent.
[14:58:29]: You can disable this by adding `opt_out_usage` at the top of your Fastfile
[14:58:29]: ------------------------------
[14:58:29]: --- Step: default_platform ---
[14:58:29]: ------------------------------
[14:58:29]: Driving the lane 'ios beta' 
[14:58:29]: --------------------------
[14:58:29]: --- Step: xcode_select ---
[14:58:29]: --------------------------
[14:58:29]: Setting Xcode version to /Applications/Xcode_12.4.app for all build steps
[14:58:29]: -----------------------------
[14:58:29]: --- Step: create_keychain ---
[14:58:29]: -----------------------------
[14:58:29]: Found keychain '~/Library/Keychains/***', creation skipped
[14:58:29]: If creating a new Keychain DB is required please set the `require_create` option true to cause the action to fail
[14:58:29]: $ security list-keychains -d user
[14:58:29]: ▸ "/Users/runner/Library/Keychains/***-db"
[14:58:29]: Found keychain '/Users/runner/Library/Keychains/***-db' in list-keychains, adding to search list skipped
[14:58:29]: -------------------
[14:58:29]: --- Step: is_ci ---
[14:58:29]: -------------------
[14:58:30]: -------------------
[14:58:30]: --- Step: match ---
[14:58:30]: -------------------
[14:58:30]: Successfully loaded '/Users/runner/work/flutter-netease-music/flutter-netease-music/ios/fastlane/Matchfile' 

+----------------+-----------------------------------------------------------------------------------------------------------------+
|                                           Detected Values from './fastlane/Matchfile'                                            |
+----------------+-----------------------------------------------------------------------------------------------------------------+
| git_url        | *** |
| git_branch     | master                                                                                                          |
| storage_mode   | git                                                                                                             |
| type           | adhoc                                                                                                           |
| app_identifier | ["com.reddwarf.musicapp"]                                                                                       |
| username       | ***                                                                                                |
+----------------+-----------------------------------------------------------------------------------------------------------------+


+--------------------------------+-----------------------------------------------------------------------------------------------------------------+
|                                                            Summary for match 2.191.0                                                             |
+--------------------------------+-----------------------------------------------------------------------------------------------------------------+
| app_identifier                 | ["com.reddwarf.musicapp"]                                                                                       |
| git_url                        | *** |
| type                           | adhoc                                                                                                           |
| readonly                       | true                                                                                                            |
| keychain_name                  | ***                                                                                                  |
| generate_apple_certs           | true                                                                                                            |
| skip_provisioning_profiles     | false                                                                                                           |
| username                       | ***                                                                                                |
| team_id                        | ***                                                                                                      |
| storage_mode                   | git                                                                                                             |
| git_branch                     | master                                                                                                          |
| shallow_clone                  | false                                                                                                           |
| clone_branch_directly          | false                                                                                                           |
| force                          | false                                                                                                           |
| force_for_new_devices          | false                                                                                                           |
| skip_confirmation              | false                                                                                                           |
| skip_docs                      | false                                                                                                           |
| platform                       | ios                                                                                                             |
| derive_catalyst_app_identifier | false                                                                                                           |
| fail_on_name_taken             | false                                                                                                           |
| skip_certificate_matching      | false                                                                                                           |
| skip_set_partition_list        | false                                                                                                           |
| verbose                        | false                                                                                                           |
+--------------------------------+-----------------------------------------------------------------------------------------------------------------+

[14:58:30]: Cloning remote git repo...
[14:58:30]: If cloning the repo takes too long, you can use the `clone_branch_directly` option in match.
[14:58:30]: Checking out branch master...
[14:58:30]:   Successfully decrypted certificates repo
[14:58:30]: Couldn't find a valid code signing identity for distribution... creating one for you now
+---------------------------+-----------------------------------------------------+
|                                  Lane Context                                   |
+---------------------------+-----------------------------------------------------+
| DEFAULT_PLATFORM          | ios                                                 |
| PLATFORM_NAME             | ios                                                 |
| LANE_NAME                 | ios beta                                            |
| KEYCHAIN_PATH             | ~/Library/Keychains/***                  |
| ORIGINAL_DEFAULT_KEYCHAIN | "/Users/runner/Library/Keychains/***-db" |
+---------------------------+-----------------------------------------------------+
[14:58:30]: No code signing identity found and can not create a new one because you enabled `readonly`

+------+------------------+-------------+
|           fastlane summary            |
+------+------------------+-------------+
| Step | Action           | Time (in s) |
+------+------------------+-------------+
| 1    | default_platform | 0           |
| 2    | xcode_select     | 0           |
| 3    | create_keychain  | 0           |
| 4    | is_ci            | 0           |
|    | match            | 0           |
+------+------------------+-------------+

[14:58:30]: fastlane finished with errors

what should I do to fix the problem?

1 Answers

I see that is_ci also ran. Does your match command look like this: match(.., readonly: is_ci, ...) and are you running the command on a CI service like Jenkins or some other one? If so, run it locally first, that will generate all the relevant certs and provisioning profiles needed. Then run it on your CI service again.

Related