Hi, you should take a look at:
http://docs.mendix.com/refguide/on-premises-git/
keep in mind that there are some limitations to using your own git provider over mendix teamserver (also documented there) and that not all git providers play nice with the large file size of mendix .mpr files.
Note that everything you want from git is already available when using mendix' own git repository (teamserver), this option should really only be used if it fits your enterprise solution better (e.g. for CI/CD purposes).