After moving Bamboo to a new server, all plan-related Git operations stop working
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
After moving the Bamboo instance to a new server, all plan-related Git operations stop working.
Diagnosis
Whenever running a Plan that contains a Repository, Bamboo reports the following error in the UI:
Unable to detect changes
This error may have occurred due to an authentication issue with Bitbucket Server. Save the repository configuration to refresh the authentication details or manually add the access key visible in "Advanced" section to Bitbucket Server.
(com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException : com.atlassian.bamboo.repository.RepositoryException: com.atlassian.bamboo.executor.CancelException: /usr/bin/git could not be started: command [/usr/bin/git version] failed with code -1. Working directory was [/]. [])
Additionally, a message similar to the one below can be found in the <bamboo-home>/logs/atlassian-bamboo.log
file:
2021-05-26 05:23:12,296 INFO [9-BAM::PlanExec:pool-16-thread-3] [DefaultErrorHandler] Recording an error: Unable to detect changes : PROJ-PLAN : com.atlassian.bamboo.repository.RepositoryException: com.atlassian.bamboo.executor.CancelException: /usr/bin/git could not be started: command [/usr/bin/git version] failed with code -1. Working directory was [/]. []
Cause
This is caused when Bamboo is unable to run the Git executable, either because it is not installed, its binary is not reachable on the new server, or the executable points to the wrong path.
Solution
- On the new Bamboo server operating system, validate if the Git package is correctly installed
- Review Git's binary permissions and ensure that the Bamboo service account can run it
- Make sure that Bamboo is pointing to the correct Git executable path by following the "
Bamboo Administration > Overview > Server capabilities"
menu. Clicking on "Detect server capabilities" may help Bamboo find Git's location. - Check your Bamboo service account's
PATH
environment variable, it should contain Git's binary location for Bamboo to detect it correctly
For a list of supported Git versions, check Bamboo's Supported Platforms documentation: