The centrality dependence of the mean charged-particle multiplicity as a function of pseudorapidity is measured in approximately 1 $\mu$b$^{-1}$ of proton--lead collisions at a nucleon--nucleon centre-of-mass energy of $\sqrt{s_{_{\rm{NN}}}} = 5.02$ TeV using the ATLAS detector at the Large Hadron Collider. Charged particles with absolute pseudorapidity less than 2.7 are reconstructed using the ATLAS pixel detector. The $p$+Pb collision centrality is characterised by the total transverse energy measured in the Pb-going direction of the forward calorimeter. The charged-particle pseudorapidity distributions are found to vary strongly with centrality, with an increasing asymmetry between the proton-going and Pb-going directions as the collisions become more central. Three different estimations of the number of nucleons participating in the $p$+Pb collision have been carried out using the Glauber model as well as two Glauber--Gribov inspired extensions to the Glauber model. Charged-particle multiplicities per participant pair are found to vary differently for these three models, highlighting the importance of including colour fluctuations in nucleon--nucleon collisions in the modelling of the initial state of $p$+Pb collisions.