Restoring a Time Machine backup to a machine with a password on the drive
Go back to the screen that lets you see the initial screen if there isn't a Utilities menu where you can access Disk Utility.

At that point, you want to fire up Disk Utility and eject the backup disk (or start over without the backup drive connected) and erase the target drive.


https://support.apple.com/kb/PH22241


This will wipe all data and the OS off that drive but it won't ask for the password since you aren't reading the data - just making a new blank filesystem on top of the old one.

Then you can proceed to boot and choose the blank drive to restore.

A full guide is available from Apple on how to erase and install an OS.


https://support.apple.com/kb/PH25649


Just remember to not erase your only copy of bootable macOS or have a plan to make a bootable drive if you need one.