Bamboo failed to run git
Asked by systembug:

Some log, i use bamboo-java-build image.

|----------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 11-Mar-2015 21:05:24 | Build gaea - gaea-nightly - Nightly Deploy #8 (GAEA-GAEAN-JOB1-8) started building on agent Elastic Agent on i-fa79bdf7                                                           |
| 11-Mar-2015 21:05:24 | Build working directory is /home/bamboo/bamboo-agent-home/xml-data/build-dir/GAEA-GAEAN-JOB1                                                                                      |
| 11-Mar-2015 21:05:24 | Executing build gaea - gaea-nightly - Nightly Deploy #8 (GAEA-GAEAN-JOB1-8)                                                                                                       |
| 11-Mar-2015 21:05:24 | Starting task 'Checkout Default Repository' of type 'com.atlassian.bamboo.plugins.vcs:task.vcs.checkout'                                                                          |
| 11-Mar-2015 21:05:24 | Build always requires a clean checkout                                                                                                                                            |
| 11-Mar-2015 21:05:24 | Cleaning build directory '/home/bamboo/bamboo-agent-home/xml-data/build-dir/GAEA-GAEAN-JOB1'                                                                                      |
| 11-Mar-2015 21:05:24 | Updating source code to revision: 808c2eb0fa4815d8b1057edcf88fbbf447380750                                                                                                        |
| 11-Mar-2015 21:05:24 | Updating source code to revision: 808c2eb0fa4815d8b1057edcf88fbbf447380750                                                                                                        |
| 11-Mar-2015 21:05:25 | Updating source code to revision: 808c2eb0fa4815d8b1057edcf88fbbf447380750                                                                                                        |
| 11-Mar-2015 21:05:25 | Error occurred while running Task 'Checkout Default Repository(1)' of type com.atlassian.bamboo.plugins.vcs:task.vcs.checkout.                                                    |
| 11-Mar-2015 21:05:25 | java.lang.RuntimeException: com.atlassian.bamboo.plugins.git.GitCommandException: command /usr/bin/git version failed with code -1. Working directory was \[/\]., stderr:         |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:132)                                                                                        |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.executor.RetryingTaskExecutor.runTask(RetryingTaskExecutor.java:88)                                                                                       |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.executor.RetryingTaskExecutor.retry(RetryingTaskExecutor.java:191)                                                                                        |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.executor.RetryingTaskExecutor.retry(RetryingTaskExecutor.java:176)                                                                                        |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask.execute(VcsCheckoutTask.java:172)                                                                                        |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:220)                                                                                             |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.task.TaskExecutorImpl.executePreparationTasks(TaskExecutorImpl.java:73)                                                                                   |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.build.pipeline.tasks.PrepareBuildTask.call(PrepareBuildTask.java:74)                                                                                      |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:188)                                                                                        |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:112)                                                            |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:110)                                                                                        |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:49)                                                                                                      |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31)                                                                                         |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20)                                                                          |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52)                                                                                           |
| 11-Mar-2015 21:05:25 | at java.lang.Thread.run(Thread.java:701)                                                                                                                                          |
| 11-Mar-2015 21:05:25 | Caused by: com.atlassian.bamboo.plugins.git.GitCommandException: command /usr/bin/git version failed with code -1. Working directory was \[/\]., stderr:                          |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:551)                                                                                  |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.plugins.git.GitCommandProcessor$1.load(GitCommandProcessor.java:177)                                                                                      |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.plugins.git.GitCommandProcessor$1.load(GitCommandProcessor.java:168)                                                                                      |
| 11-Mar-2015 21:05:25 | at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3568)                                                                                      |
| 11-Mar-2015 21:05:25 | at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2350)                                                                                                      |
| 11-Mar-2015 21:05:25 | at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2313)                                                                                               |
| 11-Mar-2015 21:05:25 | at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2228)                                                                                                           |
| 11-Mar-2015 21:05:25 | at com.google.common.cache.LocalCache.get(LocalCache.java:3965)                                                                                                                   |
| 11-Mar-2015 21:05:25 | at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3969)                                                                                                             |
| 11-Mar-2015 21:05:25 | at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4829)                                                                                                  |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.plugins.git.GitCommandProcessor.checkGitExistenceInSystem(GitCommandProcessor.java:203)                                                                   |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.\<init\>(NativeGitOperationHelper.java:87)                                                                           |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.plugins.git.GitOperationHelperFactory.createGitOperationHelper(GitOperationHelperFactory.java:25)                                                         |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.plugins.git.GitRepository.retrieveSourceCode(GitRepository.java:385)                                                                                      |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.plugins.git.GitRepository.retrieveSourceCode(GitRepository.java:358)                                                                                      |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.plugins.git.GitRepository.retrieveSourceCode(GitRepository.java:350)                                                                                      |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.plugins.hg.BitbucketRepository.retrieveSourceCode(BitbucketRepository.java:309)                                                                           |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask.fillWorkingDirFromVcs(VcsCheckoutTask.java:259)                                                                          |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask.access$100(VcsCheckoutTask.java:56)                                                                                      |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask$2.call(VcsCheckoutTask.java:177)                                                                                         |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask$2.call(VcsCheckoutTask.java:173)                                                                                         |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:108)                                                                                        |
| 11-Mar-2015 21:05:25 | ... 15 more                                                                                                                                                                       |
| 11-Mar-2015 21:05:25 | Caused by: com.atlassian.utils.process.ProcessNotStartedException: /usr/bin/git could not be started                                                                              |
| 11-Mar-2015 21:05:25 | at com.atlassian.utils.process.ExternalProcessImpl.start(ExternalProcessImpl.java:332)                                                                                            |
| 11-Mar-2015 21:05:25 | at com.atlassian.utils.process.ExternalProcessImpl.execute(ExternalProcessImpl.java:113)                                                                                          |
| 11-Mar-2015 21:05:25 | at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:542)                                                                                  |
| 11-Mar-2015 21:05:25 | ... 36 more                                                                                                                                                                       |
| 11-Mar-2015 21:05:25 | Caused by: [java.io](http://java.io).IOException: Cannot run program "/usr/bin/git" (in directory "/"): [java.io](http://java.io).IOException: error=2, No such file or directory |
| 11-Mar-2015 21:05:25 | at java.lang.ProcessBuilder.start(ProcessBuilder.java:488)                                                                                                                        |
| 11-Mar-2015 21:05:25 | at com.atlassian.utils.process.ExternalProcessImpl.createDefaultProcess(ExternalProcessImpl.java:367)                                                                             |
| 11-Mar-2015 21:05:25 | at com.atlassian.utils.process.ExternalProcessImpl.createProcess(ExternalProcessImpl.java:375)                                                                                    |
| 11-Mar-2015 21:05:25 | at com.atlassian.utils.process.ExternalProcessImpl.start(ExternalProcessImpl.java:329)                                                                                            |
| 11-Mar-2015 21:05:25 | ... 38 more                                                                                                                                                                       |
| 11-Mar-2015 21:05:25 | Caused by: [java.io](http://java.io).IOException: [java.io](http://java.io).IOException: error=2, No such file or directory                                                       |
| 11-Mar-2015 21:05:25 | at java.lang.UNIXProcess.\<init\>(UNIXProcess.java:164)                                                                                                                           |
| 11-Mar-2015 21:05:25 | at java.lang.ProcessImpl.start(ProcessImpl.java:81)                                                                                                                               |
| 11-Mar-2015 21:05:25 | at java.lang.ProcessBuilder.start(ProcessBuilder.java:470)                                                                                                                        |
| 11-Mar-2015 21:05:25 | ... 41 more                                                                                                                                                                       |
| 11-Mar-2015 21:05:25 | Failed to prepare the build 'gaea - gaea-nightly - Nightly Deploy #8 (GAEA-GAEAN-JOB1-8)'                                                                                         |
| 11-Mar-2015 21:05:25 | Running on server: post build plugin 'Clover Delta Calculator'                                                                                                                    |
| 11-Mar-2015 21:05:25 | Running on server: post build plugin 'Build Hanging Detection Configuration'                                                                                                      |
| 11-Mar-2015 21:05:25 | Running on server: post build plugin 'NCover Results Collector'                                                                                                                   |
| 11-Mar-2015 21:05:25 | Running on server: post build plugin 'Maven Dependencies Postprocessor'                                                                                                           |
| 11-Mar-2015 21:05:25 | All post build plugins have finished                                                                                                                                              |
| 11-Mar-2015 21:05:25 | Generating build results summary...                                                                                                                                               |
| 11-Mar-2015 21:05:25 | Saving build results to disk...                                                                                                                                                   |
| 11-Mar-2015 21:05:25 | Indexing build results...                                                                                                                                                         |
| 11-Mar-2015 21:05:25 | Finished building GAEA-GAEAN-JOB1-8.                                                                                                                                              |


Answers:
author: rsperafico
body: Hello Albert,

Thank you for your question.

Could you please run the following from terminal, please:

```
# displays git locationwhich git?# displays git versiongit --version?echo $PATH
```

In Bamboo, please do not forget to [Define a new version control capability](https://confluence.atlassian.com/display/BAMBOO/Defining+a+new+version+control+capability).

Please, add a Script task to your build with the following command:

```
# it will display all environment variables available to Bamboo, including Git capabilityset?# displays git locationwhich git# displays git versiongit --version
```

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

---

Kind regards,  
Rafael P. Sperafico  
Atlassian Support