For anyone having to constantly reset package caches because of a “cannot find remotes/refs/main" error from #Swift package manager, this fixed it for me: https://stackoverflow.com/a/73405564/681493
SPM unknown error reference not found when changing branch

Some of my project's dependencies are hosted on a private repository. It works most of the time, but sometimes when I change the current branch with git, I get this error : ❌ git@my_private_repo.gi...

Stack Overflow