Git push requires username and password

前端 未结 24 2081
灰色年华
灰色年华 2020-11-22 04:14

I cloned a Git repository from my GitHub account to my PC.

I want to work with both my PC and laptop, but with one GitHub account.

When I try to push to or p

24条回答
  •  醉酒成梦
    2020-11-22 04:51

    If you've got 2FA enabled on your Github account, your regular password won't work for this purpose, but you can generate a Personal Access Token and use that in its place instead.

    Visit the Settings -> Developer Settings -> Personal Access Tokens page in GitHub (https://github.com/settings/tokens/new), and generate a new Token with all Repo permissions:

    The page will then display the new token value. Save this value and use it in place of your password when pushing to your repository on GitHub:

    > git push origin develop
    Username for 'https://github.com': 
    Password for 'https://@github.com': 
    

提交回复
热议问题