I was using Android Studio to clone the project from GitHub private repository and two-factor authentication (2FA). I created a personal token as made in lzl124631x's answer.
Then I cloned the repo using an url like this: https://YourGitHubUsername:[email protected]/YourRepoPath.git