This paper shows how to construct anomaly free world sheet actions in string theory with $D$-branes. Our method is to use Deligne cohomology and bundle gerbe theory to define geometric objects which are naturally associated to $D$-branes and connections on them. The holonomy of these connections can be used to cancel global anomalies in the world sheet action.