- A new mechanism of generation of large-scale magnetic fields in colliding protogalactic clouds and merging protostellar clouds is discussed. Interaction of the colliding clouds produces large-scale shear motions which are superimposed on small-scale turbulence. Generation of the large-scale magnetic field is due to a ``shear-current" effect (or ``vorticity-current" effect), and the mean vorticity is caused by the large-scale shear motions of colliding clouds. This effect causes the generation of the mean magnetic field even in a nonrotating and nonhelical homogeneous turbulence. There is no quenching of the nonlinear shear-current effect contrary to the quenching of the nonlinear alpha effect, the nonlinear turbulent magnetic diffusion, etc. During the nonlinear growth of the mean magnetic field, the shear-current effect only changes its sign at some value of the mean magnetic field which determines the level of the saturated mean magnetic field. Numerical study shows that the saturated level of the mean magnetic field is of the order of the equipartition field determined by the turbulent kinetic energy. The estimated large-scale magnetic field for merging protogalactic clouds is about several microgauss, and for merging protostellar clouds is of the order of several tenth of microgauss.