Although I've already accepted one answer, I added this answer in order to clarify what is known about Gauss's work towards the general Gauss-Bonnet theorem and what is a matter of speculation; this distinction is not clear in Mark Yasuda's answer, and one might get from it incorrect impression about the roots of Gauss differential geometric ideas.
Gauss probably did know the global statement of the Gauss-Bonnet theorem, at least in the case of a simply-connected surface with boundary (like in the case of a spherical surface cutted along a small circle, see figure below; this case requires both the curvature surface integral of the piece of sphere and the line integral along the boundary). However, the Gauss-Bonnet theorem for a general surface requires topological notions like the genus $g$ of a surface and it's Euler characteristic $\chi$ ($\chi = 2 - 2g $ for oriented surface), so confirming Gauss's knowledge of it is merely a matter of speculation about the topological ideas that were slowly crystallizing in Gauss's mind.
My indications are based upon reading Oscar Bolza's treatise on Gauss's contibution to the calculus of variations and differential geometry; a section of it is devoted to "the geodetic curvature and the theorem of total curvature". In this section, Bolza analyzes Gauss's unpublshed manuscript entitled "Die Sietenkrummung" ("the side curvature"), which dates back to the years before his publication on differential geometry (the years 1822-1825). Gauss introduces in this manuscript the "extrinsic" definition of the geodesic curvature $K_g$ at a given point of a curve embedded in the surface , and gives an "intrinsic" formula for it in term of the coefficients of the first fundamental form $E,F,G$ and their first and second derivatives with respect to the curvilinear coordinates $p,q$ - this formula proves that the geodesic curvature is an isometric invariant of the surface, in contrast to the apparently extrinsic definition of it (like in the case of the "Theorema Egregium" on Gauss curvature). This result was rediscovered by Ferdinand Minding about a decade later.
In addition, Bolza makes the following remarks:
In the last section of the work mentioned previously, Gauss gives a strange transformation for the expression he found for the geodesic curvature, which is the actual core not only of Gauss's theorem about total curvature, but also of Bonnet's later generalization (1848). The expression given by Gauss has the following form: $$K_gds = \frac{\sqrt{EG-F^2}(p'dq'-q'dp')}{Ep'^2 + 2Fp'q' + Gq'^2}+\frac{\Phi(p,q,p',q')dt}{(Ep'^2 + 2Fp'q' + Gq'^2)\sqrt{EG-F^2}}$$ where $\Phi$ is a certain cubic form in variables $p', q'$ whose coefficients are rational functions of $E,F,G$ and their first derivatives with respect to $p,q$.
Bolza continues and describes Gauss derivation of the following formula (i didn't include the derivation):
$$K_gds - d\theta = Pdp + Qdq$$
where $P,Q$ are the following functions:
$$P = \frac{EF_p - \frac{1}{2}EE_q - \frac{1}{2}FE_p}{E\sqrt{EG-F^2}},Q = \frac{\frac{1}{2}EG_p - \frac{1}{2}FE_q}{E\sqrt{EG-F^2}} $$
Bolza preceeds and says that integrating these equations in geodesic polar coordinates yields Bonnet's generalization of the theorem of total curvature (the famous Gauss-Bonnet theorem):
$$\int_{\Omega} Kd\sigma = \int_{d\Omega}d\theta - \int_{d\Omega}K_gds$$
Since the boundary of the surface is a closed regular loop, $\int_{d\Omega}d\theta = 2\pi$, so this theorem agrees with the fact that the Euler characteristic of a simply-connected surface with boundary (such a surface is topologically equivalent to a closed disk) is $\chi = 1$.
The final step of integrating the expressions is not made explicitly in Gauss's manuscript.
Bolza cocludes with the following words:
It can hardly be assumed that this obvious connection could have escaped from Gauss, and so one can probably assume that Gauss was already familiar with Bonnet's generalization of his theorem, as R.V. Lilienthal and P. Stackel have concluded from the fact that Gauss wrote the expression $K_gds$ as $df$, and reffered to it as "the differential of the curvature of the side".
Finally, there is one more piece of evidence to consider - Gauss in his published treatise on differential geometry ("General investigations of curved surfaces", 1828) anounced the publication of further investigations on the "curvature integral" (such a memoir, however, didn't appear); in light of this unpublished work, it's not difficult to guess what he had in mind when he made the anouncement.
As an illustration of several ideas expressed in this answer, I've added this figure.
A sphere cutted along a small circle is an example of a curved and simply-connected surface with a non-geodesic boundary (boundary with geodesic curvature). The case of Gauss-Bonnet theorem which was probably covered in Gauss's investigations assures that for all geometries (including those with metric, Gauss curvature and/or geodesic curvature different than a punctured sphere) with this topology (i.e, homeomorphic to a sphere with a hole) the sum of the total curvature of the surface and the total geodesic curvature of it's boundary is always $2\pi$.