• 问题描述:

    remote: chen_sheng: Incorrect username or password (access token)
    fatal: Authentication failed for 'https://gitee.com/chen__sheng/about_company_note.git/'
    
    • 错误原因(reason):git push -u origin master,第一次向远程git仓库的master分支上提交需要username和password,如果输入错误的username或者password就会触发这个错误。

    • 解决办法(solution):

    1.	输入:git config --system --unset credential.helper命令。
    	-	命令含义:帮助清除本地已经缓存的username和password.
    
    2.	再输入:git  push  -u  origin master(或其他分支名,如dev/xxx)。
    	-	重新输入正确是username和password就可以了,不需要重新设置username和password.
    	
    3.	在git push之前设置一个SSH的公钥到GitHub/GitLab/Gitee上
        - 具体设置方法:
            - 1)输入:ssh-keygen -t rsa -C "[youremail@example.com](mailto:youremail@example.com)" 
            	-	创建SSH Key ,RSA的公钥和私钥地址的具体地址,输入后git终端会提示.
            - 2)然后在本地电脑上找到public key,复制里面的内容,到Github/GitLab/Gitee的安全设置,”SSH公钥“里面添加一个公钥就可以了,公钥的标题和公钥的具体内容写个年月日干什么就行了,如2020年1月1日_publibc_key_insert。
    
    4.	查看用户信息: git config --list
    

不知道如何设置Github/GitLab/Gitee的同学可以另行百度/Google/Bing。

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐