Global warming is mainly caused due to the increased amounts of greenhouse gases in the atmosphere. These gases allow longwave radiations to enter into the atmosphere but do not let them leave, so these radiations remain trapped in the atmosphere and cause the mean temperature to rise. This is similar to the effect of glass walls in a greenhouse on the plants.