I was reading a proof of the following theorem by A. Ramanathan :
Let $X$ be a smooth connected oriented surface and $G$ be a connected topological group. Then there is a bijection between the set of isomorphism classes of topological principal $G$-bundles on $X$ and the fundamental group $\pi_1(G)$.
To give a map in the forward direction, let $E$ be a principal $G$-bundle on $X$. the author first chooses a point $x\in X$ and a neighborhood $D$ of $x$ homeomorphic to a disk. Then he claims that the bundle is trivial on both $D$ and $X-\{x\}$. The bundle is surely trivial on $D$, since $D$ is contractible; however, the author argues triviality on $X-\{x\}$ in the following manner:
if we consider X as a CW-complex of dim 2, since $G$ is connected, there is no obstruction to the existence of a section of the principal bundle on $X - x$.
I couldn't understand this argument. I know that to show the bundle is trivial it is enough to produce a global section, but how does it follow from $X$ being CW-complex and $G$ connected? Any help would be appreciated.
This follows from obstruction theory. The obstructions to finding a section of a principal $G$-bundle $E \to B$ lie in $H^n(B; \pi_{n-1}(G))$. If all the obstructions vanish, then such a section exists.
Now let $B = X\setminus\{x\}$ and note that this is homotopy equivalent to a wedge of circles which is a one-dimensional CW complex. So the first and only obstruction to finding a section lies in $H^1(X\setminus\{x\}; \pi_0(G))$. As $G$ is connected, $\pi_0(G) = 0$ and so the cohomology group is trivial.
This can also be seen using classifying spaces. See this answer for example.