Aiming at solving the problem that the measurement accuracy and veracity of the star sensor is seriously affected by stray light for a geocentric pointing three-axis stabilized satellite, this paper analyzed how the sunlight and the moonlight impacted on the star sensor during the satellite onorbit running. This method is proposed on basic of studying geometric position of Sun, Earth, Moon and the satellite, considering several elements including the satellite attitude, the star-sensor installation location and field of vision(FOV). Moreover, according to the layout of star-sensor, recommended plans at different time are discussed and given, which can avoid bad influences of stray light effectively.