Finding subgame perfect equilibrium
Note, there is a mistake in FOC---it should be 
$$\beta/(g_1+g_2) - 1 =0,$$
so the response function of firm $2$ is
$$g_2 = \beta - g_1.$$

This means that a unit increase in a public good contributed by firm $1$ causes firm $2$ to decrease its contribution by the same unit. Then, notice that firm $1$, who correctly anticipates such a (optimal) response by firm $2$, is better off by not contributing anything (hint: $g_1$ only affects $C(g_1)$ up to $g_1 \in [0,\beta]$).

I guess you can take from here to solve the second part