God allows the man to eat from every tree of the garden except “the tree of the knowledge of good and evil” Genesis 2:16–17. The warning adds that in the day he eats of it, he will surely die.
In Genesis 2:15–17 Yahweh God places the man in Eden with a clear task and a clear boundary. The man is to work the garden and protect or watch over it. He is also given a command about eating: he may eat from every tree in the garden with full freedom, except for one named tree. These verses sit inside the Eden narrative (Genesis 2:4–25), which narrows from the creation of the world to the placing of one man in a specific garden.
Genesis 2:15–17 presents human life in Eden as both gift and responsibility. Yahweh God intentionally places the man in the garden, assigns him real work (“dress/work”) and real care (“keep”), and then speaks a direct command. The command is framed first as wide permission: the man may eat from every tree.
A careful answer keeps the immediate passage, the book's argument, and the whole-Bible storyline together, so the question is answered in context instead of as a detached idea.
Start with Genesis 2:16-17, then read the surrounding section so the answer stays connected to the passage's flow.
16Yahweh God commanded the man, saying, "Of every tree of the garden you may freely eat:
17but of the tree of the knowledge of good and evil, you shall not eat of it: for in the day that you eat of it you will surely die."