I've been forced by github to enable 2FA with the following banner:
GitHub users are now required to enable two-factor authentication as an additional security measure. Your activity on GitHub includes you in this requirement. You will need to enable two-factor authentication on your account before October 12, 2023, or be restricted from account actions.
Fortunately, i managed to make the switch using the FLOSS oathtool, a non-bloated CLI program written in C.
Once you click the "Enable 2FA" button, github presents you a barcode and a link to uncover the embedded "setup key". All you really need is the setup key, which as it turns out is Base32-encoded. The next step is to enter a 6-digit code supplied by the TOTP app. Here it is extremely important that your system clock is correct, best to sync with NTP directly before use. The generated code is valid during 30 second "windows", so it is possible that if you're unlucky the window ends just in the next second.
The following oathtool command line provides you with the code: oathtool -b --totp=SHA1 SETUPKEY
where SETUPKEY is the key presented to you earlier.
Don't forget to save it in a secure place.
Due to aforementioned time windows, it's possible you got to try 2-3 times copy/pasting the code spit out by oathtool, but in the end it will succeed.
Once the code is accepted, github will provide you with some recovery codes which you can use to restore your account in case something goes wrong.
You are a hero, sir! Thanks a lot!