It's really unfortunate that these functions aren't thread-safe, but, since they're not, we should synchronize on the remote or the repository to avoid other threads interfering.