def push(
        self,
        refspec: Union[str, List[str], None] = None,
        progress: Union[RemoteProgress, "UpdateProgress", Callable[..., RemoteProgress], None] = None,
        kill_after_timeout: Union[None, float] = None,
        allow_unsafe_protocols: bool = False,
        allow_unsafe_options: bool = False,
        **kwargs: Any,
    ) -> PushInfoList:
        """Push changes from source branch in refspec to target branch in refspec.

        :param refspec:
            See :meth:`fetch` method.

        :param progress:
            Can take one of many value types:

            * ``None``, to discard progress information.
            * A function (callable) that is called with the progress information.
              Signature: ``progress(op_code, cur_count, max_count=None, message='')``.
              See :meth:`RemoteProgress.update <git.util.RemoteProgress.update>` for a
              description of all arguments given to the function.
            * An instance of a class derived from :class:`~git.util.RemoteProgress` that
              overrides the
              :meth:`RemoteProgress.update <git.util.RemoteProgress.update>` method.

        :note:
            No further progress information is returned after push returns.

        :param kill_after_timeout:
            To specify a timeout in seconds for the git command, after which the process
            should be killed. It is set to ``None`` by default.

        :param allow_unsafe_protocols:
            Allow unsafe protocols to be used, like ``ext``.

        :param allow_unsafe_options:
            Allow unsafe options to be used, like ``--receive-pack``.

        :param kwargs:
            Additional arguments to be passed to :manpage:`git-push(1)`.

        :return:
            A :class:`PushInfoList` object, where each list member represents an
            individual head which had been updated on the remote side.

            If the push contains rejected heads, these will have the
            :const:`PushInfo.ERROR` bit set in their flags.

            If the operation fails completely, the length of the returned
            :class:`PushInfoList` will be 0.

            Call :meth:`~PushInfoList.raise_if_error` on the returned object to raise on
            any failure.
        """
        kwargs = add_progress(kwargs, self.repo.git, progress)

        refspec = Git._unpack_args(refspec or [])
        if not allow_unsafe_protocols:
            for ref in refspec:
                Git.check_unsafe_protocols(ref)

        if not allow_unsafe_options:
            Git.check_unsafe_options(options=list(kwargs.keys()), unsafe_options=self.unsafe_git_push_options)

        proc = self.repo.git.push(
            "--",
            self,
            refspec,
            porcelain=True,
            as_process=True,
            universal_newlines=True,
            kill_after_timeout=kill_after_timeout,
            **kwargs,
        )
        return self._get_push_info(proc, progress, kill_after_timeout=kill_after_timeout)
Push changes from source branch in refspec to target branch in refspec.

        :param refspec:
            See :meth:`fetch` method.

        :param progress:
            Can take one of many value types:

            * ``None``, to discard progress information.
            * A function (callable) that is called with the progress information.
              Signature: ``progress(op_code, cur_count, max_count=None, message='')``.
              See :meth:`RemoteProgress.update <git.util.RemoteProgress.update>` for a
              description of all arguments given to the function.
            * An instance of a class derived from :class:`~git.util.RemoteProgress` that
              overrides the
              :meth:`RemoteProgress.update <git.util.RemoteProgress.update>` method.

        :note:
            No further progress information is returned after push returns.

        :param kill_after_timeout:
            To specify a timeout in seconds for the git command, after which the process
            should be killed. It is set to ``None`` by default.

        :param allow_unsafe_protocols:
            Allow unsafe protocols to be used, like ``ext``.

        :param allow_unsafe_options:
            Allow unsafe options to be used, like ``--receive-pack``.

        :param kwargs:
            Additional arguments to be passed to :manpage:`git-push(1)`.

        :return:
            A :class:`PushInfoList` object, where each list member represents an
            individual head which had been updated on the remote side.

            If the push contains rejected heads, these will have the
            :const:`PushInfo.ERROR` bit set in their flags.

            If the operation fails completely, the length of the returned
            :class:`PushInfoList` will be 0.

            Call :meth:`~PushInfoList.raise_if_error` on the returned object to raise on
            any failure.
        
git/remote.py