Native Git fails when system TMP or TEMP directories contain spaces in the path
Symptoms
Bamboo build fails to fetch branch and the following appears in the Bamboo build logs:
Build working directory is d:\bamboo\builds\BAM-BAMBOO-JOB1
01-Nov-2012 12:31:14 Executing build BAM-BAMBOO-JOB1-32
01-Nov-2012 12:31:14 Starting task 'Checkout Default Repository' of type 'com.atlassian.bamboo.plugins.vcs:task.vcs.checkout'
01-Nov-2012 12:31:14 Updating source code to revision: 776a51ab4ad1874267dc4d0371fd10990c0fcf6d
01-Nov-2012 12:31:14 Cannot fetch branch '(unresolved) 776a51ab4ad1874267dc4d0371fd10990c0fcf6d' from 'git@github.com:path/Bamboo.git' to source directory 'd:\bamboo\builds\BAM-BAMBOO-JOB1'. command 'C:\Program Files (x86)\Git\bin\git.exe' ls-remote ssh://3456ba5b-f440-4ae5-b2a2-bd19a1d51685@127.0.0.1:1356/company/Bamboo.git failed with code 128. Working directory was [d:\bamboo\builds\BAM-BAMBOO-JOB1]., stderr:['C:\Documents' is not recognized as an internal or external command,, operable program or batch file., fatal: The remote end hung up unexpectedly]
Cause
There are spaces in the system TMP/TEMP directory paths. This issue is being tracked here: https://jira.atlassian.com/browse/BAM-12375
Resolution
This is a generic Git + Windows limitation. What happens is that Bamboo creates an SSH wrapper script in the current temporary directory and configures Git to use it via GIT_SSH
variable. We need to use the wrapper to pass additional parameters to SSH.
This solution works fine, unless the platform is Windows and the temp directory name contains a space character. It's a bug in Git code used on Windows platform. We've fixed it and submitted a patch to Git developers.
The easiest solution is to change the temp directory. For instance, running the remote agent (or Bamboo server - depending where the job runs) with "java.io.tmpdir
" set to a directory without spaces in the name helps to work around the issue.