It is important to keep tension on the string as you wind it up. When you put it through the tuning post, stick it through there you can already get a "free" half wind (like in from the left hand side of the peg).
Then, bring the string back over the top around to the right while keeping some tension on. That should be enough to hold it on the post while you wind it up. Also, use Neal's suggestion to bend the free end opposite to the windto help hold it.
Use one finger to hold it down in the slot in the nut, until it has enough tension to stay there. While doing that, you can twist the back of your hand up to keep the slack taken up.
Do not just wind it around the post with your hand. You'll get a crappy wind. You should try for a nice even wind from top to bottom. There's a technically correct way where you loop first over the top, then the rest under, but don't even worry about that for now.
Proper length is the other thing. That takes some practice and how much slack to start with depends on which string you are winding. For sure, you do not need or want to wind up the whole string. Try to get 2 or 3 full turns around the post at least, but not so many turns that you are making a double layer of string.
Don't be afraid to undo it and add or reduce slack if necessary (although repeated rebending on a spot can weaken the string). Once you get it right, you can use them to compare your next set against when you put them on.
Just in case: you want to wind the string up on the side of the post away from the peg.
Hope that helps!
...so ever since then, I always hang on to the buckle.