During spreading and migration, the leading edges of cells undergo periodic protrusion--retraction cycles. The functional purpose of these cycles is unclear. Here, using submicrometer polydimethylsiloxane pillars as substrates for cell spreading, we show that periodic edge retractions coincide with peak forces produced by local contractile units (CUs) that assemble and disassemble along the cell edge to test matrix rigidity. We find that, whereas actin rearward flow produces a relatively constant force inward, the peak of local contractile forces by CUs scales with rigidity. The cytoskeletal protein α-Actinin is shared between these two force-producing systems. It initially localizes to the CUs and subsequently moves inward with the actin flow. Knockdown of α-Actinin causes aberrant rigidity sensing, loss of CUs, loss of protrusion-retraction cycles, and, surprisingly, enables the cells to proliferate on soft matrices. We present a model based on these results in which local CUs drive rigidity sensing and adhesion formation.