Making use of a structural model that allows for optimal liquidity management, we study the role that repos play in a bank's financing structure. In our model the bank's assets consist of illiquid loans and liquid reserves and are financed by a combination of repos, long--term debt, deposits and equity. Repos are a cheap source of funding, but they are subject to an exogenous rollover risk. We show that their use adds to the cost of long--term debt financing, which limits the bank's appetite for unstable repo funding. This effect is, however, weakened under poor returns on assets, abundant deposit funding and the depositor preference rule. We also analyze the impact of a liquidity coverage ratio, payout restrictions and a leverage ratio on the bank's financing choices and show that all these tools are able to curb the bank's reliance on repos.