In this Article, We will se how we Can enable MFA (Multi Factor Authentication) or We can also call It as 2FA (2 Factor Authentication) on your Github Account. MFA gives you additional layer of security where an Owner of Github or any other platform will asked for additional random generated code along with the password to login. Random generated Codes will be in your mobile/PC along with you, so even some one knows your password won’t be able to login without the Authentication code.
Let’s see how we can do this.
Login to Github account and Click on Settings.
Now Click on Setup using an App.
Now Download the Recovery Codes for future Recovery. This is required because just in case you lost your phone or reset it and somehow lost you app, then using this you will still be able to login to github.
Now you will see the bar code which you have to scan using any of the below mobile app which you can download from google store/ Apple store.
- Google Authenticator.
Just Search for any of the app in play store and scan the bar code.
Once you scanned the bar code you have to put the generated code and Click on Enable. So no once you login to your github account from the next time you will be prompted for the 2FA code.
Once the MFA is activated in github, you probably will be unable to clone repository using https protocol. So you need to perform key based authentication with github. Add your ssh public key (id_rsa.pub) to github.
Once the Key has been added, try below command for initial authentication and try cloning repositories using ssh protocol.