my old horse was terrible about it.
I used to stand outside his stall with his feed bucket and grain in it.
When he moved to the back of the stall i would walk in, if he tried to crowd me I walked back out.
Eventually he realized that if he took a step I was outta there and he Wasn't getting fed.

He still pinned his ears at me, but as long as there was no kick/biting/pushing etc it was fine.

A horse can teach a girl courage, if she chooses to grab mane and hang on for dear life.