Support for resolving private packages through HTTPS with xcodebuild

Hi :wave:,
We are using the Swift Package Manager in some of our Xcode projects to integrate packages that live in other private repos of the organization. Everything works fine, except when we run builds on CI. Despite having the right Git configuration to authenticate successfully with our Git provider, the xcodebuild process fails with the following error:

xcodebuild: error: Could not resolve package dependencies:
  Failed to clone repository https://github.com/foo/bar:
    Cloning into bare repository '/Users/anka/Library/Developer/Xcode/DerivedData/...'...
    fatal: could not read Username for 'https://github.com': terminal prompts disabled

After some reading, I found this blog post that mentions that HTTPS is not supported, and also noticed that Apple's official documentation mentions suggests to use SSH. Unfortunately, using SSH is not possible with GitHub apps, and the proxy solution suggested in the former post seems too much overhead.

Is there a way for xcodebuild's package resolution to successfully do authentication through HTTPS using the global git configuration?

We use HTTPS and SSH at my work interchangeably using both Xcode and xcodebuild (and vanilla SwiftPM for that matter) in our CI. In the end, I think it is fair to say that package manager is not the limitation here but likely your ability to supply the correct credentials while running in your CI.

How are you providing your credentials for https://github.com during your CI runs?

If you use xcodebuild -scmProvider xcode, HTTPS can be used, but you would typically log in via Xcode preferences to your SCM service account.

Let me try to find out whether there is a way to accomplish this on a CI system as well.

Looks like there is no alternative to using the Xcode UI today, so you would need to login once via that on the CI machine to store the credentials and then using xcodebuild -scmProvider xcode should be able to use those credentials you configured.

Terms of Service

Privacy Policy

Cookie Policy