protected function getPushUrl($dir, $throws = false)
    {
        try {
            $remotes = $this->git->workingCopy($dir)->remote('show', 'origin',  '-n')->getOutput();

            if (preg_match('!Push\s*URL:\s*([^\s#]+)!', $remotes, $matches)) {
                return $matches[1];
            }
        } catch (GitException $exception) {
            if ($throws) {
                throw $exception;
            }
        }

        return null;
    }