Preheat oven to 325 degrees F (165 degrees C). Lightly grease a 2 1/2-quart baking dish with a lid.
Place the green beans in a large pan with water to cover; bring to a boil and cook only until the beans are hot and bright green, about 1 minute. Drain. Transfer to a large bowl.
Cook the bacon in a large, deep skillet over medium-high heat, stirring occasionally, until evenly browned and crisp, about 10 minutes. Pour off all but 1 tablespoon of the drippings. Return to the heat and add the green onions; cook until the onions have softened, about 2 minutes.
Add the bacon mixture, Cheddar cheese, sour cream, mayonnaise, salt, and pepper to the green beans; stir. Spread the mixture into the prepared baking dish; cover with the lid.
Bake in the preheated oven until the casserole is bubbling and the beans are tender, about 20 minutes.