def METHOD_NAME(self, path: str) -> None:
    from scmrepo.exceptions import FileNotInRepoError
    from dvc.scm import SCMError
    try:
        gitignore_file = self.scm.METHOD_NAME(path)
    except FileNotInRepoError as exc:
        raise SCMError(str(exc))  # noqa: B904
    if gitignore_file:
        logger.debug("Added '%s' to gitignore file.", path)
        self.track_file(relpath(gitignore_file))
        return self.ignored_paths.append(path)