A theoretical study of the transport properties of zigzag and armchair graphene nanoribbons with a magnetic barrier on top is presented. The magnetic barrier modifies the energy spectrum of the nanoribbons locally, which results in an energy shift of the conductance steps towards higher energies. The magnetic barrier also induces Fabry-Perot type oscillations, provided the edges of the barrier are sufficiently sharp. The lowest propagating state present in zigzag and metallic armchair nanoribbons prevent confinement of the charge carriers by the magnetic barrier. Disordered edges in nanoribbons tend to localize the lowest propagating state, which get delocalized in the magnetic barrier region. Thus, in sharp contrast to the case of two-dimensional graphene, the charge carriers in graphene nanoribbons cannot be confined by magnetic barriers. We also present a novel method based on the Greens function technique for the calculation of the magnetosubband structure, Bloch states and magnetoconductance of the graphene nanoribbons in a perpendicular magnetic field. Utilization of this method greatly facilitates the conductance calculations, because, in contrast to excising methods, the present method does not require self-consistent calculations for the surface Greens function.