Xcode Cloud can't access SPM dependencies in GitHub private repo?

Can Xcode Cloud resolve dependencies that are in private GitHub repos?

  • Project is in GitHub Enterprise Cloud. Our GitHub is not self hosted.

  • I am an organization owner in GitHub.

  • Project is private.

  • Project is using swift packages for dependencies.

  • Some dependencies are public repos.

  • Some dependencies are private repos inside the same GitHub organization.

I have given permission to the "Xcode Cloud" GitHub app to access all the repos of the organization. This means the "Xcode Cloud" GitHub app is listed in GitHub settings of the project, and the Github settings of every dependency.

When I build with Xcode Cloud, during the "xcodebuild -resolvePackageDependencies..." step, it gives these errors. I've blanked out my repo and project name.

Command line invocation:

    /Applications/Xcode-beta.app/Contents/Developer/usr/bin/xcodebuild -resolvePackageDependencies -workspace /Volumes/workspace/repository/___.xcworkspace -scheme ___ -derivedDataPath /Volumes/workspace/DerivedData

	User defaults from command line:

	    IDEDerivedDataPathOverride = /Volumes/workspace/DerivedData

      IDEPackageSupportUseBuiltinSCM = YES

Resolve Package Graph

Fetching from git@github.com:___.git

Fetching from git@github.com:___.git


skipping cache due to an error: Failed to clone repository git@github.com:___.git:

 Cloning into bare repository '/Users/local/Library/Caches/org.swift.swiftpm/repositories/___...

 fatal: could not read Username for 'http://github.com': terminal prompts disabledan out-of-date resolved file was detected at /Volumes/workspace/repository/___.xcworkspace/xcshareddata/swiftpm/Package.resolved, which is not allowed when automatic dependency resolution is disabled; please make sure to update the file to reflect the changes in dependencies. Running resolver because the following dependencies were added: '___' (git@github.com:___.git)

	Resolved source packages:

	  ___: (null)

The package.resolved file is in the repo, and it isn't out of date, so I think that error isn't accurate.

On appstoreconnect website, in the Xcode cloud tab of the project, under Settings, it says it still needs access to all the swift package repos. The access has already been given and it's checked off in green, yet it still asks for access on the same dependency repos.

The following private repositories were discovered from Git submodules, Custom Scripts, and Dependency Managers. Only repositories that have been granted access can be used for building “___”.


Access Requested (3)

Grant access to the following repositories to allow them to be used for this product.

Pressing the "Grant" button on one of the listings just takes me to a white page for a second, then to the default appstoreconnect home page. It looks like it tries get access, realized it's already granted, and just erroneously defaults back to the home page.


Furthermore, I tested all of this on some brand new test project with a dummy private swift package dependency, and the exact same looking errors showed up again.

When I set the dummy dependency's GitHub access from private to public, Xcode Cloud resolves the dependency without error, and builds the test project as well. So it seems like xcodebuild in the Xcode Cloud instance can't or won't use ssh to access the private repos.

I've read the docs on https://developer.apple.com/documentation/xcode/connecting-xcode-cloud-to-github

Can Xcode Cloud resolve dependencies that are in private GitHub repos? It's all in the same organization. There are green checkmarks all over in Xcode when setting up the access to github, all the repos have been given access.

Thanks!

Answered by corey-mps in 731024022

Try again in private / incognito

Accepted Answer

Try again in private / incognito

Using incognito on Safari to grant access worked. The private dependency's repo in the test project was added to the "Access Granted" list. Thank you Corey.

Can confirm this worked eventually- might also help to delete your Xcode Cloud data on AppStore and set it up again

Xcode Cloud can't access SPM dependencies in GitHub private repo?
 
 
Q