Question: how long do you have to stay in the us to keep your green card?
Answer: If you hold a green card and know in advance that you must be outside the United States for more than one year, it's worth applying to USCIS for a reentry permit. This lets you to stay away for up to two years. See Don't Lose Your Green Card Due to Long Absence From the U.S.