The people of Gibeon were not Israelites; they were a small group of Amorites whom the Israelites had promised to protect, but Saul had tried to destroy them because of his zeal for the people of Israel and Judah.)
“As surely as I am the living God,” says the Sovereign Lord, “this king will die in Babylonia because he broke his oath and the treaty he had made with the king of Babylonia, who put him on the throne.
The city and everything in it must be totally destroyed as an offering to the Lord. Only the prostitute Rahab and her household will be spared, because she hid our spies.
So they went and brought Rahab out, along with her father and mother, her brothers, and the rest of her family. They took them all, family and slaves, to safety near the Israelite camp.
Joshua made a treaty of friendship with the people of Gibeon and allowed them to live. The leaders of the community of Israel gave their solemn promise to keep the treaty.