def create_git_worktree(self, content_version):
        """
        Create a git worktree for the provided git content version.

        :return: Path to the created git worktree directory.
        :rtype: ``str``
        """
        pack_name = self.get_pack_name()
        pack_directory = get_pack_directory(pack_name=pack_name)
        worktree_path = tempfile.mkdtemp(prefix=self.WORKTREE_DIRECTORY_PREFIX)

        # Set class variables
        self.git_worktree_revision = content_version
        self.git_worktree_path = worktree_path

        extra = {
            "pack_name": pack_name,
            "pack_directory": pack_directory,
            "content_version": content_version,
            "worktree_path": worktree_path,
        }

        if not os.path.isdir(pack_directory):
            msg = (
                'Failed to create git worktree for pack "%s". Pack directory "%s" doesn\'t '
                "exist." % (pack_name, pack_directory)
            )
            raise ValueError(msg)

        args = [
            "git",
            "-C",
            pack_directory,
            "worktree",
            "add",
            worktree_path,
            content_version,
        ]
        cmd = list2cmdline(args)

        LOG.debug(
            'Creating git worktree for pack "%s", content version "%s" and execution '
            'id "%s" in "%s"'
            % (pack_name, content_version, self.execution_id, worktree_path),
            extra=extra,
        )
        LOG.debug("Command: %s" % (cmd))
        exit_code, stdout, stderr, timed_out = run_command(
            cmd=cmd,
            cwd=pack_directory,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            shell=True,
        )

        if exit_code != 0:
            self._handle_git_worktree_error(
                pack_name=pack_name,
                pack_directory=pack_directory,
                content_version=content_version,
                exit_code=exit_code,
                stdout=stdout,
                stderr=stderr,
            )
        else:
            LOG.debug('Git worktree created in "%s"' % (worktree_path), extra=extra)

        # Make sure system / action runner user can access that directory
        args = ["chmod", "777", worktree_path]
        cmd = list2cmdline(args)
        run_command(cmd=cmd, shell=True)

        return worktree_path

        Create a git worktree for the provided git content version.

        :return: Path to the created git worktree directory.
        :rtype: ``str``
        
st2common/st2common/runners/base.py