A quantum internet that connects remote quantum processors1,2 should enable a number of revolutionary applications such as distributed quantum computing. Its realization will rely on entanglement of remote quantum memories over long distances. Despite enormous progress3,4,5,6,7,8,9,10,11,12, at present the maximal physical separation achieved between two nodes is 1.3 kilometres10, and challenges for longer distances remain. Here we demonstrate entanglement of two atomic ensembles in one laboratory via photon transmission through city-scale optical fibres. The atomic ensembles function as quantum memories that store quantum states. We use cavity enhancement to efficiently create atom–photon entanglement13,14,15 and we use quantum frequency conversion16 to shift the atomic wavelength to telecommunications wavelengths. We realize entanglement over 22 kilometres of field-deployed fibres via two-photon interference17,18 and entanglement over 50 kilometres of coiled fibres via single-photon interference19. Our experiment could be extended to nodes physically separated by similar distances, which would thus form a functional segment of the atomic quantum network, paving the way towards establishing atomic entanglement over many nodes and over much longer distances.