Git Clone from GitHub over https with two-factor authentication

后端 未结 6 1758
感动是毒
感动是毒 2021-01-29 23:49

I recently began using two-factor authentication on GitHub, and I am now unable to use git over https on private repos in the usual way:

peter@computer:~$ git cl         


        
6条回答
  •  一生所求
    2021-01-30 00:30

    It generally comes to mind that you have set up two-factor authentication, after a few password trials and maybe a password reset. So, how can we git clone a private repository using two-factor authentication? It is simple, using access tokens.

    How to Authenticate Git using Access Tokens

    1. Go to https://github.com/settings/tokens
    2. Click Generate New Token button on top right.
    3. Give your token a descriptive name.
    4. Set all required permissions for the token.
    5. Click Generate token button at the bottom.
    6. Copy the generated token to a safe place.
    7. Use this token instead of password when you use git clone.

    Wow, it works!

提交回复
热议问题