  By defining an appropriate field line helicity, we apply the powerful concept
of magnetic helicity to the problem of global magnetic field evolution in the
Sun's corona. As an ideal-magnetohydrodynamic invariant, the field line
helicity is a meaningful measure of how magnetic helicity is distributed within
the coronal volume. It may be interpreted, for each magnetic field line, as a
magnetic flux linking with that field line. Using magneto-frictional
simulations, we investigate how field line helicity evolves in the
non-potential corona as a result of shearing by large-scale motions on the
solar surface. On open magnetic field lines, the helicity injected by the Sun
is largely output to the solar wind, provided that the coronal relaxation is
sufficiently fast. But on closed magnetic field lines, helicity is able to
build up. We find that the field line helicity is non-uniformly distributed,
and is highly concentrated in twisted magnetic flux ropes. Eruption of these
flux ropes is shown to lead to sudden bursts of helicity output, in contrast to
the steady flux along the open magnetic field lines.
