Package update fails for package hosted on private Gitlab server

I've been struggling to understand why the "update package" feature is failing for a private package I have hosted on our company gitlab server. I am able to add the package to the project just fine, and Xcode downloads the latest version. Any time I make a change and bump the minor version of my package (e.g. 0.0.8 -> 0.0.9), I cannot get Xcode to update to the latest. I have "0.0.8 - next major" set for the version rules.

Initially adding the package to the project was successful:

But when I update my package, tag a new version e.g. 0.0.9, push to our gitlab repo (with tags), then in the project where I added this dependency, right click the package and select "Update Package" - I get the following error:

If I remove the package dependency from the project and add it again, Xcode always correctly grabs the latest version.

I have tried removing this package and running File > Packages > Reset Package Caches - then adding the package again, but it still results in the same error.

I have tried using https:// instead of git@ - and setup an access key for Xcode, but I still run into the same error.

I have found many other similar issues that people have run into, but most are ssh key or other permission issues, or seem to be resolved by a package cache reset. If anyone has run into this or has any other suggestions, I would really appreciate the help!

After more experimenting this morning, I've discovered that I run into the same issue even with a public repo hosted on gitlab.com

I created a very basic project with a single dependency, and can reproduce the exact same issue with a publicly available package.

I am running Xcode version 14.0.1

I just ran the same test with the same package hosted on GitHub.com and I am not seeing the issue anymore. It seems to be something related to Gitlab for some reason, either public or private repos.

According to this stack overflow issue I finally stumbled on, there are/can-be (I am not entirely sure) issues with packages using SSH access i.e. git@. However, simply switching to https:// URLs for my packages was insufficient, I had to clear package caches and even go as far as manually deleting some directories. I deleted the contents of:

  • ~/Library/Caches/org.swift.swiftpm
  • ~/Library/Developer/Xcode/DerivedData

Before deleting those, first I:

  • Removed all the package dependencies from my project (and test projects I created to try and understand/resolve this problem).
  • Closed Xcode
  • Deleted the above directories
  • Opened Xcode and then reimported my packages using the https:// links (not git@)

After that, I was successfully able to commit changes to my package, push to my private repo, then use the "Update Package" feature in Xcode to pull the latest version.

What fixed it for me was:

Close Xcode

Delete those folders: ~/Library/Caches/org.swift.swiftpm ~/Library/Developer/Xcode/DerivedData

Restart Xcode

Right click and "update package"

Package update fails for package hosted on private Gitlab server
 
 
Q