
Scientists have known since the 1800s that increasing CO2 levels would warm the earth.
In the 1850s, Eunice Foote discovered, and John Tyndall independently confirmed, that carbon dioxide traps heat. In the 1890s, Arrhenius calculated approximately how much the world would warm from a given carbon dioxide increase.
Through the decades, more and more studies have solidified our understanding of carbon dioxide and its ability to absorb, and re-emit in all directions, infrared heat/light.
This article was written in 1912, over 100 years ago. It says:
COAL CONSUMPTION AFFECTING CLIMATE.
The furnaces of the world are now burning about 2,000,000,000 tons of coal a year. When this is burned, uniting with oxygen, it adds about 7,000,000,000 tons of carbon dioxide to the atmosphere yearly. This tends to make the air a more effective blanket for the earth and to raise its temperature. The effect may be considerable in a few centuries.

Satellites measuring Earth's glow show greenhouse gases are responsible for global warming.
In 2001, Harries and others published this study showing that, as seen from space, Earth is dimming in infrared, even though it is warming. This is physically impossible, unless the planet is warming because it is trapping that infrared heat/light back to itself. And that is precisely what greenhouse gases do.
Moreover, the specific colors (wavelengths) where Earth is dimming correspond precisely with known greenhouse gases carbon dioxide, methane, etc.

We know greenhouse gases are responsible for global warming.
The same effect is also seen via instruments pointing up at the sky from the earth's surface.
n 2015, Feldman and others published a study showing how much infrared heat/light returns to the earth's surface on clear nights. That closely follows seasonal variations in carbon dioxide levels as well as the decade-by-decade increase in CO2.

Feldman et al 2015 allows a back-of-the-envelope confirmation of cause and effect.
Feldman et al gave their results in energy per unit time per unit area, which allows us to extrapolate how much additional energy the world has trapped due to the greenhouse effect. Using high school calculus, this image shows that calculation.
The result is as expected: the expected increase in Earth's heat content is approximately equal to the increase that scientists have been observing.
The numbers match; the mystery is solved. Essentially all of modern warming is caused by human emissions of greenhouse gases.

Statistical analysis identifies greenhouse gases as the cause of global warming.
It's often said that statistics can show correlation but not causation. However, there is a statistical analysis method known as Information Flow that can measure causality. That approach concludes that modern warming is caused by greenhouse gases.
Specifically, Stips et al 2016 "unambiguously shows one-way causality between the total Greenhouse Gases and GMTA. Specifically, it is confirmed that the former, especially CO2, are the main causal drivers of the recent warming."

Many attribution studies indicate essentially ALL modern warming is caused by human activity.
Tett et al. 2000,
Meehl et al. 2004,
Stone et al 2007,
Lean and Rind 2008,
Huber and Knutti 2011,
Gillett et al. 2012,
Wigley and Santer 201,
Jones et al. 2013, and
Ribes et al. 2016:
Each of these studies concludes essentially all modern warming is caused by human activity. These studies used computer modeling to assess the contributions of natural and human forcings.