eas build locally on mac doesnt set right provisioning profile

I’m using the bare workflow.
I try to build the app using eas build --platform ios --local --non-interactive via Gitlab CI on my local build runner.
This is my credentials.json in the root of my project:

    "ios": {
        "provisioningProfilePath": "ios/AppStore.mobileprovision",
        "distributionCertificate": {
            "path": "ios/Certs.p12",
            "password": "xxxxx"

These files are put in the right location in the right location of my project, I verified that by logging in to the machine.

For some weird reason my build fails with the following error in the logs of xcode

/tmp/eas-build-local-nodejs/f85ecf76-0f72-4187-8de0-a3c309b6842b/build/ios/ProjName.xcodeproj: error: No signing certificate "iOS Distribution" found: No "iOS Distribution" signing certificate matching team ID "[redacted]" with a private key was found. (in target 'ProjApp' from project 'ProjApp')

But that is weird, since it should use another dir.
I already updated the targets in the xcworkspace, to update them to use the correct provisioning profile.

The weird thing is that running from my local terminal, and the terminal on the build server it works.
EAS build in the cloud works as well. However, I don’t know how to find out why my gitlab job on this machine doesn’t work.

It’s unlikely if you are using that mac only to run CI, but in the past I saw some issues where certs in system keychain were causing issues when using local builds, maybe try removing any ios certs from the keychain.

More likelly there is an issue with keychain access, e.g. I can’t use local build when I’m sshing into the macOS, but it works perfectly if I use the same command directly on device. Maybe the issue is with how gitlub runs the service that runs those jobs.