Two authentication two-factor authentication on GitHub, how to update and upload code at the command line

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.