We show that repurchase agreements (repos) arise as the instrument of choice to borrow in a competitive model with limited commitment. The repo contract traded in equilibrium provides insurance against fluctuations in the asset price in states where collateral value is high and maximizes borrowing capacity when it is low. Haircuts increase both with counterparty risk and asset risk. In equilibrium, lenders choose to re-use collateral. This increases the circulation of the asset and generates a "collateral multiplier" effect. Finally, we show that intermediation by dealers may endogenously arise in equilibrium, with chains of repos among traders.