The circumstances of the initial appointment in 1922 are debated, but Trotsky claims that Lenin was opposed to it and only reluctantly agreed - saying about Stalin that "this cook will only prepare peppery [in Russian: sharp/spicy] dishes". Nobody besides Trotsky has directly confirmed this statement, but it became well known and other Bolsheviks opposed to Stalin quoted it later. When the issue of his excessive power over the Secretariat becoming power over the party (since he selected regional secretaries, and half the CC in 1924 was composed of the regional secretaries, mostly indebted to Stalin's Secretariat for their jobs), Stalin did offer to resign the post (obviously as a symbolic gesture) and his colleagues (especially Zinoviev and Kamenev who were still allied with Stalin against Trotsky) "pressured" him to stay.
In one of these instances after Lenin's "testament" erupted into an intra-party scandal (the "testament" was just a dictation of the ailing Lenin calling for the removal of Stalin from the post of General Secretary among other things), Stalin said:
"At the very first plenary meeting of the Central Committee after the
Thirteenth Congress, I [Stalin] requested the Central Committee plenum to release me from the duties of general secretary. The congress itself discussed this question. Each delegation discussed this question, and all the delegations, including Trotsky, Kamenev, and Zinoviev, obliged Stalin to remain at his post. What, then, could I do? Flee the post? That is not in my character."
(this was quoted in Pravda of 1927, and in Tucker's biography of Stalin, Vol 1)