def _set_alternates(self, alts: List[str]) -> None:
        """Set the alternates.

        :param alts:
            The array of string paths representing the alternates at which git should
            look for objects, i.e. ``/home/user/repo/.git/objects``.

        :raise git.exc.NoSuchPathError:

        :note:
            The method does not check for the existence of the paths in `alts`, as the
            caller is responsible.
        """
        alternates_path = osp.join(self.common_dir, "objects", "info", "alternates")
        if not alts:
            if osp.isfile(alternates_path):
                os.remove(alternates_path)
        else:
            with open(alternates_path, "wb") as f:
                f.write("\n".join(alts).encode(defenc))
Set the alternates.

        :param alts:
            The array of string paths representing the alternates at which git should
            look for objects, i.e. ``/home/user/repo/.git/objects``.

        :raise git.exc.NoSuchPathError:

        :note:
            The method does not check for the existence of the paths in `alts`, as the
            caller is responsible.
        
git/repo/base.py