找不到代码签名身份并且无法创建新身份,因为您启用了“只读”

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

当我使用 fastlane 在 github 中发布 ios 应用时:

- 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 }}

显示此错误:

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

这是日志的一部分:

+-----------------------+---------+--------+
|               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

我应该怎么做才能解决这个问题?

我看到 is_ci 也 运行。您的 match 命令是否如下所示: match(.., readonly: is_ci, ...) 并且您是 运行 在 Jenkins 或其他服务等 CI 服务上执行命令吗? 如果是这样,运行 它首先在本地生成,这将生成所需的所有相关证书和配置文件。然后 运行 它再次出现在您的 CI 服务上。