It is clear that neither the term male or female can apply to God.
Therefore, the answer to your question is not to view Hashem in any gender - neither as a He nor a She.
We just use gender terms because they are convenient terms that we as humans can relate to. There is no "it" in Hebrew; there is either "he" or "she". The Torah has to choose one or the other. There are two principal reasons for referring to God in the masculine:
1. Biologically in the act of procreation, the male is the "giver" and the female is the "receiver". In the same way God as the Creator and sustainer of the world is the ultimate giver, and hence He is referred to as a male.
2. God also is the source of all power and strengths in the world. Since the male of the species (in the vast majority of cases) is the stronger, we refer to God as male.