One of the important tradition in Hinduism is the Gotra. Usually marriage is not performed between two persons belonging to the same Gotra. Does this have anything to do with biological relationship ? What happens when someone is adopted as a baby and the parents are not known ? Does the baby accept the Gotra of the adopted father ? What about persons who don't know their Gotra but who otherwise have spiritual masters. Is there any fall back system or method ?
When a child's gotra is not known then he will usually adopt the gotra of the person who adopted him.
Also, he can adopt the gotra of his guru who initiates him during upanayana samskara / gayatri deeksha (if done).
Further, not knowing gotra is not a major criterion in spirituality. Because, as per the legend of Satyakama Jabali, he was not aware of his gotra yet his guru initiated him into brahma vidya because of his genuine aspiration and jijnasa.