Liam Monninger
Liam Monninger

Reputation: 85

How can I force Xcode to respect Git insteadOf for dependencies?

Issue

I'm relatively new to Swift and am trying to write a library that depends on PromiseKit and Starscream. This is my first time trying to use SwiftPM instead of a third-party PM.

If I use this installation pattern ...

dependencies: [
        // Dependencies declare other packages that this package depends on.
        // .package(url: /* package url */, from: "1.0.0"),
        .package(url: "https://github.com/daltoniam/Starscream.git", from : "4.0.0"),
        .package(url: "https://github.com/mxcl/PromiseKit", from: "6.8.0")
]

... I am thrown The operation couldn’t be completed. (SwiftPM.SPMRepositoryError error 5.)

If I switch this to the ssh url pattern, I can get the top level packages. But, then the submodules of PromiseKit fail because they are are included in PromiseKit with https://...

dependencies: [
        // Dependencies declare other packages that this package depends on.
        // .package(url: /* package url */, from: "1.0.0"),
        .package(url: "[email protected]:daltoniam/Starscream.git", from : "4.0.0"),
        .package(url: "[email protected]:mxcl/PromiseKit", from: "6.8.0")
]

Environment

[url "[email protected]:"]
    insteadOf = https://github.com/

Question

It seems Xcode is simply ignoring this. What can I do? Using an access token has also failed me to this point.

Upvotes: 2

Views: 1043

Answers (1)

ukostas
ukostas

Reputation: 236

it seems that xcode has own (embedded?) git which does not care about local/global configs. you can tell XCode to use system git instead :

defaults write com.apple.dt.Xcode IDEPackageSupportUseBuiltinSCM YES

then restart xcode to pick setting. note:I think your git config should be set globally (not per project) to resolve dependencies.

Upvotes: 13

Related Questions