The microbiota control regional immunity using mechanisms such as inducing IL-17A-producing γδ T (γδT-17) cells in various tissues. However, little is known regarding hepatic γδT cells that are constantly stimulated by gut commensal microbes. Here we show hepatic γδT cells are liver-resident cells and predominant producers of IL-17A. The microbiota sustain hepatic γδT-17 cell homeostasis, including activation, survival and proliferation. The global commensal quantity affects the number of liver-resident γδT-17 cells; indeed, E. coli alone can generate γδT-17 cells in a dose-dependent manner. Liver-resident γδT-17 cell homeostasis depends on hepatocyte-expressed CD1d, that present lipid antigen, but not Toll-like receptors or IL-1/IL-23 receptor signalling. Supplementing mice in vivo or loading hepatocytes in vitro with exogenous commensal lipid antigens augments the hepatic γδT-17 cell number. Moreover, the microbiota accelerate nonalcoholic fatty liver disease through hepatic γδT-17 cells. Thus, our work describes a unique liver-resident γδT-17 cell subset maintained by gut commensal microbes through CD1d/lipid antigens.