Sefer Chofetz Chaim hilchos rechilus chapter 1 halacha 8

 If sone one asked asked what so and so said about them and you can’t push them off with half a lie to avoid speaking rechilus then you are allowed to fully lie for the sake of peace but you can’t swear falsely if he refuses to accept what you say.

The proof that you can lie to avoid the sin of rechilus is from a gemara in Sanhedrin 30a. When the court wrote up the final decision Rebbe Yochanan held you just write innocent (or guilty) as if it was unanimous, to avoid rechilus. Relish Lakish held you write out which judge said innocent or guilty to not look like you are lying and Rebbe Eliezer, the student of Rebbe Yochanan, compromised with writing “Based on their words he is innocent”. This implies that it wasn’t necessarily a unanimous decision but it also doesn’t spell out which judges said what. We poskin like Rebbe Eliezer, and he doesn’t argue with his Rebbe, Rebbe Yochanan, but is adding that if you can minimize the lie while avoiding rechilus you should do so, which is exactly what the halacha here is saying.

There is a Braisa in Yevamos 65b which says it’s a mitzvah to lie for the sake of peace. The Rif there and the Rosh in Bava Metzia 6:21poskin thatvitvis a mitzvah to lie for the sake if peace. If this is a statement from the rabbis in the time of the Mishna then Reish Lakish who lived in the times of the gemara can’t argue that, so how can he argue on the braisa on Yevamos and say it’s better not to lie? The answer is that Reish Lakish held that once the verdict is done and it’s just a matter of putting it onto paper the guilty party won’t be any more angry then he is right now if he finds out who said what. Only when things aren’t finalized yet and you tell on someone then it will make things worse.

This halacha is also based on how Hashem spoke to Avraham when informing him he will have a child through Sarah. Based on the Ramban there Sarah said I am old and my husband is old so how can we conceive a child? Hashem only related how Sarah made fun if herself that she was old but not that he was old. We see from there that Hashem spoke the truth half way and just left out the rest for the sake of peace which is what one should try to do when avoiding rechilus. When it comes to swearing falsely that’s absolutely forbidden however if the guy is really pressing you and doesn’t believe what you are saying there is a concept called a shevua b’oness, a forced oath which if done falsely you are not guilty. But it’s not so easily applied in this case See Yoreh Deah 232:14 in the Rema.