You may be confusing several different things:
- a build scripting system (e.g. Ant, Gradle, ...)
- a code repository (e.g. a SVN or GIT repository such as BitBucket or GitHub)
- a compile environment (e.g. JDK)
The building is done by the compiler, such as the JDK, for example by calling javac.exe. Building means that the java files are compiled to class files and perhaps placed in a jar file.
To automate the building, typically build scripting systems such as Gradle are used. A build script describes what to compile and build. A build script could for example call javac on your java files and then place them in a runnable jar.
And finally you can store your source code, along with the build scripts, in a code repository. Typically you upload ("commit") only the source files and the build script, and not the built class and jar files generated by the build script, but that is up to you.
So if you want to learn about build systems, for example Gradle in combination with LibGDX:
- read more about how java applications are compiled
- read the Gradle tutorials
- make a simple java project (for example a couple of classes with no libraries or natives) which you try to compile using a gradle build script you wrote yourself from scratch
- take a close look at the libgdx gradle script, and try to see if you can figure out what it does (this may be a bit hard, though)