SwiftPM "Couldn't get the list of tags" in CI
To resolve a version range, SwiftPM lists the dependency's git tags. This error means that fetch failed: the repository was unreachable, the credentials were missing, or the clone was interrupted.
What this error means
Resolution fails with "error: Couldn't get the list of tags" and the repository URL, often after a transient network hiccup or a private repo without auth.
swift
error: Couldn't get the list of tags:
Fetching https://github.com/acme/networking.git
fatal: could not read Username for 'https://github.com': terminal prompts disabledCommon causes
Missing credentials for a private repository
SwiftPM cannot authenticate to fetch tags, and with terminal prompts disabled in CI the clone fails outright.
A transient network or clone failure
A dropped connection or a slow host interrupts the tag fetch, so SwiftPM cannot enumerate versions.
How to fix it
Authenticate the clone for private repos
- Configure SSH or a token so the runner can read the repository.
- Rewrite HTTPS URLs to SSH, or use a
.netrcfor HTTPS auth. - Re-run
swift package resolve.
Terminal
git config --global url."git@github.com:".insteadOf "https://github.com/"Retry transient fetch failures
For a purely transient drop, a clean re-run usually succeeds once the network settles.
Terminal
rm -rf .build/repositories
swift package resolveHow to prevent it
- Commit
Package.resolvedso revisions come from the pin, not a fresh tag list. - Configure auth for private dependencies before resolving.
- Cache the SwiftPM repositories directory across runs.
Related guides
SwiftPM "failed to clone ... authentication failed" for a private package in CIFix SwiftPM "error: failed to clone ... authentication failed" in CI - a private SPM dependency needs an SSH…
SwiftPM "could not find 'git'" fatalError in CIFix SwiftPM "fatalError ... could not find 'git'" in CI - SwiftPM needs a git binary on PATH to fetch depende…
SwiftPM "dependency 'X' could not be resolved" in CIFix SwiftPM "error: 'X' dependency ... could not be resolved" in CI - SwiftPM could not satisfy a requirement…