Skip to content
Latchkey

Bamboo "Failed to source repository" in CI

Bamboo tried to fetch source from the linked repository before the build and failed. The agent could not connect, authenticate, or verify the host, so no checkout happened.

What this error means

The build log ends the checkout phase with "Failed to source code repository" or "Failed to source repository", often followed by the underlying git or SSH error.

Bamboo
Failed to source code repository.
com.atlassian.bamboo.repository.RepositoryException: Unable to source the repository.

Common causes

Wrong or missing repository credentials

The stored username, password, token, or SSH key for the repository is invalid or absent, so the agent cannot authenticate.

Unreachable host or unverified host key

The agent cannot reach the VCS host, or the host key is not trusted, so the connection is refused before any fetch.

How to fix it

Fix the repository credentials

  1. Open the repository configuration (linked or plan-local) and re-enter the credentials or SSH key.
  2. Confirm the URL and branch are correct for the agent to reach.
  3. Use Test connection if available, then re-run the build.
Bamboo administration
# Bamboo administration > Linked repositories > <repo> > Authentication
# re-enter username/password or SSH private key; verify the repository URL

Trust the VCS host key on the agent

For SSH remotes, ensure the agent host has the repository host key in known_hosts so the connection is not rejected.

Terminal
ssh-keyscan -H git.example.com >> ~/.ssh/known_hosts

How to prevent it

  • Store repository credentials in shared linked repositories, not scattered per plan.
  • Rotate and update repository tokens in one place when they expire.
  • Pre-seed agent known_hosts for every VCS host you build from.

Frequently asked questions

What causes ""Failed to source repository""?
The stored username, password, token, or SSH key for the repository is invalid or absent, so the agent cannot authenticate.
How do I fix "Failed to source repository"?
Fix the repository credentials

Related guides

References

Run this faster and cheaper on Latchkey managed runners - self-healing included. Start free → 30-day trial · No credit card