public function execute($cmd, $git = true, $cwd = null)
    {
        if ($git) {
            $cmd = $this->getBinaryPath() . ' ' . $cmd;
        }
        $stream = ssh2_exec($this->resource, $cmd);
        stream_set_blocking($stream, 1);
        $data = stream_get_contents($stream);
        fclose($stream);
        // rtrim values
        $values = array_map('rtrim', explode(PHP_EOL, $data));
        $this->outputLines = $values;

        return $this;
    }