5

I'm attempting to build my iOS app on bitrise.io. This app uses an SPM package which is hosted in a private github repo. The repo is not able to be made public.

Locally the builds work, they also work locally with fastlane and the bitrise cli. When I run them on the remote pipeline, I get the following error:

xcodebuild: error: Could not resolve package dependencies:
  Failed to clone repository https://github.com/USERNAME_REDACTED/REPO_NAME_REDACTED:
    Cloning into bare repository '/Users/vagrant/Library/Developer/Xcode/DerivedData/ORG_NAME_REDACTED/SourcePackages/repositories/REPO_NAME_REDACTED-d35b1ef7'...
    fatal: could not read Username for 'https://github.com': terminal prompts disabled

My understanding as to why this does not work, is because the Xcode instance on the remote pipeline machine, does not have a GitHub account added. I am able to do this using the Xcode GUI locally by going to Xcode > Preferences > Accounts as you can see below

Xcode Add Account

The problem here is that I need to figure out a way to do this via script for the remote by providing a username and personal access token. Thus far I've spent about 20 hours looking through xcodebuild docs and messing around with different configs however I've not had any luck getting this to work.

Any help is appreciated.

Brandon Stillitano
  • 1,304
  • 8
  • 27
  • Ask not what Xcode can do for you. Ask what you can do for oAuth like OAuthSwift and p2.OAuth2. – El Tomato Aug 10 '21 at 20:36
  • What would either of those libraries achieve here? They would allow a swift app to authenticate with GitHub which is not what the question is asking. – Brandon Stillitano Aug 10 '21 at 23:01

1 Answers1

0

Changing the Xcode project to use ssh to import the module worked for this. I had to also change the remote CI machine to use the system keychain in order to fetch the SSH key.

Brandon Stillitano
  • 1,304
  • 8
  • 27