def validExistingRepo(self):
    try:
        assert os.path.isdir(self._path), 'The supplied directory does not exist.'
        os.chdir(self._path)
        cmd = subprocess.Popen('git rev-parse --is-bare-repository', shell=True, stdout=subprocess.PIPE)
        cmd.wait()
        assert (cmd.returncode != 128), 'The supplied directory exists, but is not a git repo.'
        assert (cmd.returncode == 0), 'There was an unhandled git error.'
        firstline = cmd.stdout.readlines()[0].decode('utf8')
        assert ('false' not in firstline), 'The supplied directory is NOT a bare repo.'
        assert ('true' in firstline), 'Unable to verify that the repo is bare.'
        cmd = subprocess.Popen('git config --get remote.origin.url', shell=True, stdout=subprocess.PIPE)
        cmd.wait()
        firstline = cmd.stdout.readlines()[0].decode('utf8')
        assert (self._origin_url in firstline), 'The existing repo has a url that differs from the supplied origin url.'
        return True
    except AssertionError as err:
        print('The given path does not contain a valid repo by:', err)
        return False
def validExistingRepo(self):
    try:
        assert os.path.isdir(self._path), 'The supplied directory does not exist.'
        os.chdir(self._path)
        cmd = subprocess.Popen('git rev-parse --is-bare-repository', shell=True, stdout=subprocess.PIPE)
        cmd.wait()
        assert (cmd.returncode != 128), 'The supplied directory exists, but is not a git repo.'
        assert (cmd.returncode == 0), 'There was an unhandled git error.'
        firstline = cmd.stdout.readlines()[0].decode('utf8')
        assert ('false' not in firstline), 'The supplied directory is NOT a bare repo.'
        assert ('true' in firstline), 'Unable to verify that the repo is bare.'
        cmd = subprocess.Popen('git config --get remote.origin.url', shell=True, stdout=subprocess.PIPE)
        cmd.wait()
        firstline = cmd.stdout.readlines()[0].decode('utf8')
        assert (self._origin_url in firstline), 'The existing repo has a url that differs from the supplied origin url.'
        return True
    except AssertionError as err:
        print('The given path does not contain a valid repo by:', err)
        return False