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.
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
- Open the repository configuration (linked or plan-local) and re-enter the credentials or SSH key.
- Confirm the URL and branch are correct for the agent to reach.
- Use Test connection if available, then re-run the build.
# Bamboo administration > Linked repositories > <repo> > Authentication
# re-enter username/password or SSH private key; verify the repository URLTrust 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.
ssh-keyscan -H git.example.com >> ~/.ssh/known_hostsHow 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.