Here are details I remember: the main character doesn't know she's a girl; she's being raised by some kind of monk-warrior society/enclave that is situated apart from the rest of society.
There is a life/death trial involved and the main character begins the tale in position to take part in the testing of some new potential "recruit" to the enclave. I believe that men are exiled to this place and, if they survive the trial, they get to stay: failure = death.
The girl has lived all her life as a boy and thinking she was no different from the men of the "monastery". Something happens and she discovers she's been deceived all her life about her sex.