Only one has walked this earth who kept the Ten Commandments perfectly, and that was Jesus. Everyone else has fallen short.
We have broken the Ten Commandments in more ways than we realize. We have taken the Lord's name in vain. We have had other gods before Him. We have lied. Perhaps we have stolen or have committed adultery or even murder. At the very least, we have lusted or hated. Yet the Bible says that if we stumble in one point of the law, we are guilty of all of it (see James 2:10).
Why, then, did God give us these commandments? They were not given to make us righteous. They were given to show us that we are not righteous. They were given to show us that we fall short of God's standards. They were given to show us that we need help. The commandments drive us into the open arms of Jesus, who died on the cross for all our sins.
The Bible says, "He canceled the record of the charges against us and took it away by nailing it to the cross" (Colossians 2:14). What that means is Jesus took the penalty of the commandments that say, "The person who sins is the one who will die" (Ezekiel 18:20). He died in our place and absorbed God's wrath that should have come upon me and upon you.
Maybe you need to repent of some sin. God will forgive you—but you have to admit your sin, stop making excuses for it, and turn from it. The Bible says, "But if we confess our sins to him, he is faithful and just to forgive us our sins and to cleanse us from all wickedness" (1 John 1:9).