Tangent space of moduli of stable principal $G$-bundles on a compact Riemann surface This is probably a dumb question.
Let $G$ be a connected complex reductive group and $X$ a compact Riemann surface.  Consider a stable principal $G$-bundle $P$ on $X$.  I am interested in how one uses deformation theory to prove that the tangent space at $P$ to the moduli space of principal $G$-bundles equals $H^1(X,\mathfrak g_P)$, where $\mathfrak g_P$ means the vector bundle associated to the adjoint representation of $G$.
I understand that a differential-geometric proof can be found, for example, in Kobayashi's book titled 'Differential geometry of complex vector bundles'.  I am pretty sure there is a deformation-theoretic proof, but I failed at my attempts to find it.  Does anyone know what is the right place to look for the answer?  Also, what is a good reference of deformation theory in general?  Thank you very much!
 A: I don't know if this is what you're looking for, but here's a heuristic argument for this sort of thing being true in great generality. This should be a comment but it got long. 
It's not hard to convince yourself that the tangent space to a map $f : X \to Y$, in the space of maps from $X$ to $Y$, whatever that means, is the space of sections of the pullback of the tangent bundle of $Y$ along $f$, or in other words $H^0(X, f^{\ast}(T_Y))$. (The generality in which you're willing to accept that something like this is true depends on the generality in which you're willing to talk about tangent spaces; here $X$ and $Y$ might be smooth manifolds or smooth varieties or something more general according to taste.) 
In this situation $Y = BG$ is stacky and so its "tangent bundle" is also stacky; it's $\mathfrak{g}$, regarded as a representation of $G$ (and hence as a vector bundle on $BG$), but in degree $1$. The pullback of this tangent bundle along the classifying map of a $G$-bundle $f : X \to BG$ is the adjoint bundle of the $G$-bundle, but in degree $1$. And so its space of sections ends up being $H^1$ of the adjoint bundle. 
A: Let $k = \mathbb{C}$ be the field of complex numbers. Let $({\rm Art}_k)$ be the category of all Artin local $k$-algebra with residue field $A/\mathfrak{m} \cong k$. Let $E_H$ be a holomorphic (or equivalently, algebraic) principal $H$-bundle over $X$. For given any $A \in ({\rm Art}_k)$, the surjective ring homomorphism $A \longrightarrow A/\mathfrak{m} \cong k$ induces a closed embedding $i : X \hookrightarrow X_A := X\times {\rm Spec}(A)$. 
Consider the contravariant functor (called deformation functor)
$$\mathcal{D}_{E_H} : ({\rm Art}_k)^{\rm op} \longrightarrow ({\rm Set})$$ 
defined by setting $\mathcal{D}_{E_H}(A)$ to be the set of all equivalence classes $[F, \theta]$, where $F$ is a holomorphic principal $H$-bundle on $X_A = X\times_k{\rm Spec}(A)$ together with an isomorphism of principal $H$-bundles $\theta : i^*F \longrightarrow E_H$ over $X$. Two such pairs $(F,\theta)$ and $(F',\theta')$ are said to be equivalent if there is an isomorphism of principal $H$-bundles 
$\eta : F \longrightarrow F'$ over $X_A$ such that $\theta = \theta'\circ i^*(\eta)$. 
Take $A = k[\epsilon]$, with $\epsilon^2 = 0$, i.e., $A = k[t]/(t^2)$. 
Let $(F,\theta) \in \mathcal{D}_{E_H}(k[\epsilon])$. 
Take any open subscheme $U$ of $X$. Then $U(\epsilon) := U\times_k {\rm Spec}(k[\epsilon])$ is an open subscheme of $X(\epsilon) := X\times_k{\rm Spec}(k[\epsilon])$. Then take an affine open cover $\{V_i := U_i(\epsilon)\}_{i \in I}$ of $X(\epsilon)$, and fix trivializations $F\vert_{V_i} \stackrel{f_i}{\longrightarrow} V_i\times H$. Then the transition functions for $F$ are of the form $g_{ij}+\epsilon\cdot h_{ij}$, where $g_{ij} : U_i\cap U_j \longrightarrow H$ are transition functions for $E_H = i^*F$, and $h_{ij} \in \Gamma(U_i\cap U_j, {\rm ad}(E_H))$ are sections of the adjoint vector bundle ${\rm ad}(E_H)$. Recall that,  ${\rm Ad}(E_H) = E_H\times^H H$ is a group scheme of all principal $H$--bundle automorphisms of $E_H$ over $X$, with Lie algebra ${\rm ad}(E_H)$. The $H$--bundle automorphisms of $F$, which restricts to identity over the closed points $X \hookrightarrow X(\epsilon)$, is the adjoint vector bundle ${\rm ad}(E_H)$. Therefore, a section $s$ of ${\rm ad}(E_H)$ corresponds to the automorphism $1 + \epsilon s$ of $F$. Also if $s_1, s_2$ are two sections of ${\rm ad}(E_H)$, then $s_1 + s_2$ corresponds to the composite automorphism $(1+\epsilon s_1)(1+\epsilon s_2) = 1+\epsilon(s_1+s_2)$, since $\epsilon^2 = 0$. Now one can see that, these $h_{ij}$ defines a $1$--cocycle for ${\rm ad}(E_H)$, and hence defines an element of $H^1(X, {\rm ad}(E_H))$. The converse is also similar. Therefore, we have a canonical bijection $\mathcal{D}_{E_H}(k[\epsilon]) \cong H^1(X, {\rm ad}(E_H))$. Therefore, the space of all infinitesimal deformations of the principal $H$--bundle $E_H$ over $X$ is parametrized by $H^1(X, {\rm ad}(E_H))$. 
Reference: I. Biswas and S. Ramanan, An Infinitesimal Study of the Moduli of Hitchin Pairs, doi: https://doi.org/10.1112/jlms/49.2.219.
