Habit of pushing people away

I don’t know why I push people away when they get too close to me. I’m trying my best but now there’s no one I can talk to. I’m so lonely. It’s all my fault.