Skip to content
Latchkey

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 disabled

Common 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

  1. Configure SSH or a token so the runner can read the repository.
  2. Rewrite HTTPS URLs to SSH, or use a .netrc for HTTPS auth.
  3. 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 resolve

How to prevent it

  • Commit Package.resolved so 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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →