Whenever food was presented to the Messenger of Allah ﷺ, he would eat some of it and send the rest to Abu Ayub . One day food containing garlic was presented to him, and he sent it on to Abu Ayub
without taking any of it himself.When Abu Ayub saw no trace of the Prophet ﷺ having eaten from the food, he brought it back to the Messenger of Allah ﷺ and asked him about that.He said, "I only refrained from it because of its smell."Abu Ayub replied, "Then I too dislike what you dislike."
حدثنا عبد الله حدثنا أحمد بن إبراهيم حدثنا أبو الأحوص عن سماك
كان رسول الله ﷺ إذا أهدي له طعام أصاب منه ثم بعث بفضله إلى أبي أيوب رضي الله عنه فأهدي له طعام فيه ثوم فبعث به إلى أبي أيوب رضي الله عنه ولم ينل منه شيئا فلم ير أبو أيوب أثر النبي ﷺ في الطعام فأتى به رسول الله ﷺ فسأله عن ذلك فقال إني إنما تركته من أجل ريحه قال فقال أبو أيوب وأنا أكره ما تكره
Its isnad is sahih. It will also come by way of a hadith from Abu Ayub. The hadith was narrated by Muslim, 3/1623, no. 2053, in the chapter on drinks, permissibility of eating garlic under certain conditions, and by Tirmidhi in the chapter on foods, 4/261, no. 1807.