KBEC-00420 - Stopping Path Conversion for Git Bash

Article ID:360033184131
1 minute readKnowledge base

Summary

On a Windows Agent, it is possible to Install 'Git Bash' to use Bash commands/syntax on a windows machine.

However, Git Bash will attempt to convert the POSIX path. Therefore, Commands with 'Paths' will be converted and become malformed.

For example, an Ectool setProperty Command:

ectool setProperty "/myJob/testProperty" --value "test"

Can become:

<?xml version="1.0" encoding="UTF-8"?>

<requests version="2.2" timeout="180" sessionId="[PROTECTED]">
 <request requestId="1">
 <setProperty>
 <propertyName>C:/Program Files/Git/myJob/testProperty</propertyName>
 <value>test</value>
 <jobStepId>6d8198bb-e146-11e8-a346-0e6409679d5a</jobStepId>
 </setProperty>
 </request>
</requests>


As you can see, the propertyName, contains the converted path, instead of using the relative path.

Solution

The following workaround was tested with Git Bash 4.4

To stop the conversion, you can either use '//' to stop the conversion or set the environment variable 'MSYS_NO_PATHCONV' to '1'.

To use the '//' method, you would add another '/' to any Relative or Absolute path. Therefore the previous setProperty command would become:

ectool setProperty "//myJob/testProperty" --value "test"

This '//' will work both on Git Bash and Bash.

For setting the Environment variable, you will need to add an export of the Environment Variable at the beginning of each Step Command:

export MSYS_NO_PATHCONV=1
ectool setProperty "/myJob/testProperty" --value "Created"

If either of these workarounds does not work when attempting to use Git Bash, please forward the steps you took and any details to support@cloudbees.com for analysis.