Abdullah bin Umar reported,

The Messenger of Allah ﷺ prayed two rakahs at Mina, and Abu Bakr did the same after him, as did Umar after Abu Bakr, and Uthman during the early part of his caliphate. Then Uthman later prayed four rakahs. So whenever Ibn Umar prayed with the imam, he would pray four, but when he prayed alone, he would pray two.

Azami 2875

Sahih

عن ابن عمر قال

صلى رسول الله ﷺ بمنى ركعتين. وأبو بكر بعده وعمر بعد أبي بكر، وعثمان صدرا من خلافته، ثم إن عثمان صلى بعد أربعا. فكان ابن عمر إذا صلى مع الإمام صلى أربعا، وإذا صلاها وحده صلى ركعتين.

الأعظمي 2875صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Prayer
Chapter
Witr prayer
Section
Shortening the prayer in Mina
Numbering
Jami al-Kamil 2875 (2nd edition)
Azami 2875