This is line-wrapping ugly.  I'd prefer (assuming you change scanPath to return File):

  File gitExe = scanPath(...);
  if (gitExe != null) {
    gitExe = gitExe.getAbsoluteFile();
    File bin = gitExe.getParentFile();  // discard "git.exe"
    return bin.getParentFile();  // discard "bin"
  }