Search code examples
iosswiftswift-playgroundswift-package-manager

Is it possible to add a package from a private GitHub repo to an app in Swift Playgrounds for iPad?


I'm creating an app in Swift Playgrounds for iPad and can easily add Swift Packages from public GitHub repositories this way. But how can I add a package from my private repo? I've seen answers relating to using SSH via XCode but I'm on an iPad so am assuming these wouldn't work in my case. Is there a safe way to achieve this? And if not, is there an easy way?

When I've tried adding the https url of my repo via the "Add Package" menu item, I get the following error message:

git error unknown(34):GIT_EAUTH - remote authentication required but no callback set


Solution

  • I found a similar question on the Apple Developer Forum and according to one of the answers it would work if you used a PAT (Personal Access Token).

    Since I already have one set up I decided to try it and it worked fine with one of my private repos.

    So create a PAT if you don't have it, see GitHub: Create personal Access Token and then include it in the url when adding the package to your app

    https://<your-PAT-string>@github.com/<your-username>/<your-repo-name>.git