They are both grammatically correct but neither makes much sense.
Infinitives and present participles can both function as nouns. Anywhere where "to get" is used as a noun, it can always be replaced with "getting" to produce an equally grammatical sentence, and vice versa. However, the meaning can change when you do such a switch.