<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update(self):
 """Get a repository git or update it"""

        if not os.path.isdir(os.path.join(self.path)):
            os.makedirs(self.path)
        if not os.path.isdir(os.path.join(self.path, 'refs')):
            subprocess.check_output([
                'git', 'clone', '--bare', self.repo_git, self.path
            ])
        self.run(['gc', '--auto', '--prune=all'])
        self.run(['fetch', '-p', 'origin', '+refs/heads/*:refs/heads/*'])
        # github support
        self.run(['fetch', 'origin', '+refs/pull/*/head:refs/pull/*'])
        # gitlab support
        self.run([
            'fetch', 'origin', '+refs/merge-requests/*/head:refs/pull/*'])