Recently, when you manage your code with GitHub, you run into some problems when you manage your code on the git command line.
If two validations (Two-factor authentication two feature authentication) are opened, the command line always prompts for a user name and password. Find out the workaround as follows:
1. Prepare token information.
Login to GitHub, go to the Settings page via the Settings button in the top right corner, click Personal Access tokens, create a token for your account,
Once created, save this token, preferably saved to your local file, because this will not be found after leaving the page.
Then go back to the command line interface of your computer.
2. Set up Git to save authentication information
Execute git config--global credential.helper store
3. Using the Git clone code
git clone xxxx.git
You are prompted to enter username and password, such as:
Username for ' https://github.com ': yourname (here is the name of your usernmae on GitHub, not your GitHub mailbox)
Password for ' https://[email protected] ': Here is the token you obtained.
To this OK.
If you do not set up git config--global credential.helper store, you will be prompted to enter username and password every time you git pull or git push.
If this option is set, username and password will be saved, either directly from Git pull or git push.
In fact, the command will generate a file named. git-credentials in the user root directory, which holds your username and tokens.
Two authentication two-factor authentication on GitHub, how to update and upload code at the command line