The children of Israel didn't strike them, because the princes of the congregation had sworn to them by Yahweh, the God of Israel. All the congregation murmured against the princes.
If God’s people make covenants with unbelievers, we may end up disobeying God, as Israel did (cf. 2 Corinthians 6:14-18). We need to seek the will of God before we make these commitments. We should look for it in prayer (James 1:5; James 4:2-3; James 4:15) and in Scripture (2 Timothy 3:16-17; cf. Numbers 27:21). We should also consult other godly people who understand God’s ways and can help us avoid overlooking important scriptural revelations that are pertinent (Proverbs 11:14). If we do make an unwise commitment, we should make the best of the situation, if breaking the covenant would be contrary to God’s will (e.g., marriage to an unbeliever, et al.).