search

Home  >  Q&A  >  body text

求解:github开启了两步验证后git push使用https方式 验证权限失败

hainuo@hainuo-ubuntu:/www/×××/.git$ git push 
Username for 'https://github.com': hainuo
Password for 'https://hainuo@github.com': 
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/hainuo/xi.git/'

我开启了github两步验证后应该如何解决?

由于windows下开发,编码老是自动转换成ansi或者gbk 实在搞不懂所以将电脑格式化撞了ubuntu在ubuntu下面没有githubforwindows方便的gui工具,只能够求助大家了

大家讲道理大家讲道理2878 days ago1160

reply all(2)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-04-25 09:05:17

    Already have a solution
    The reference solution is
    Remember the password and username
    Create a password for the command line

    Main code

    git config --global credential.helper store
    
    1. Go to your profile page.
    2. Applications menuIn the left sidebar, click Applications.
    3. Generate new token buttonClick Generate new token.
    4. Token description fieldGive your token a descriptive name
    5. Selecting token scopesSelect the scopes you wish to grant to this token. The default scopes allow you to interact with public and private repositories, user data, and gists.
    6. Generate token buttonClick Generate token.
    7. Newly created tokenCopy the token to your clipboard. For security reasons, after you navigate off this page, no one will be able to see the token again.

    Then all you need to do is when git push

    Username for 'https://github.com': hainuo
    Password for 'https://hainuo@github.com': 
    

    In the Password project here, you just need to paste the access token generated in the github backend

    As for where the files are saved?
    The file save location is /home/你使用的账户/
    Two files will be generated in this directory
    .gitconfig.gitconfig
    .git-credentials.git-credentials
    After that, your operations in the Linux terminal will not be disturbed by the verification process. .

    reply
    0
  • 某草草

    某草草2017-04-25 09:05:17

    After github turns on the second verification, the password when submitting uses the Personal Access Token in the personal settings instead of the account password

    reply
    0
  • Cancelreply