博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
remote: Invalid username or password.
阅读量:6485 次
发布时间:2019-06-23

本文共 2247 字,大约阅读时间需要 7 分钟。

  hot3.png

$ git pushUsername for 'https://github.com': UsernamePassword for 'https://Username@github.com':remote: Invalid username or password.fatal: Authentication failed for 'https://github.com/username/repository.git/'

What causes this error

This error message is self explanatory. It means that we are trying to use the invalid username or password. But I’m sure I’m using the correct username and password. In my case, this happened with me after I turned on a two-factor authentication (2FA) in my GitHub account. So I know what caused this error message.

How to solve it

To solve this problem all we need to do is create a GitHub personal access token and use it instead of our GitHub password and a two-factor authentication code.

Creating a GitHub personal access token.

 

In the upper-right corner of any page, click your profile photo, then click Settings.

In the left sidebar, click Developer settings.

In the left sidebar, click Personal access tokens.

Click Generate new token.

Give your token a descriptive name.

Select the scopes, or permissions, you’d like to grant this token. To use your token to access repositories from the command line, select repo.

Click Generate token.

Copy the token to your clipboard. For security reasons, after you navigate off the page, you will not be able to see the token again.

 

Note! Treat your tokens like passwords and keep them secret (if you don’t want other people to use the API on your behalf). When working with the API, use tokens as environment variables instead of hardcoding them into your programs.

Using a token on the command line.

 

Once we have a token, we can enter it instead of our password when performing Git operations over HTTPS. Just inter your token after prompted a password and then watch the magic happen…

git push
Username: your_usernamePassword: your_token

Note! Personal access tokens can only be used for HTTPS Git operations. If your repository uses an SSH remote URL, you will need to .

Note! If you are not prompted for your username and password, your credentials may be cached on your computer. You can  to replace your old password with the token.

If this article helped you solve the problem then please . :smiley:

Thanks for reading!

转载于:https://my.oschina.net/kun123/blog/1930644

你可能感兴趣的文章
MyGUI 解析
查看>>
Linux中的ls命令详细使用
查看>>
graph-tool文档(一)- 快速开始使用Graph-tool - 2.属性映射、图的IO和Price网络
查看>>
GraphicsLab Project之辉光(Glare,Glow)效果 【转】
查看>>
Linux Curl命令
查看>>
-27979 LoadRunner 错误27979 找不到请求表单 Action.c(73): Error -27979: Requested form not found...
查看>>
[LeetCode] Minimum Depth of Binary Tree
查看>>
,net运行框架
查看>>
Java 中 Emoji 的正则表达式
查看>>
Mixin Network第一届开发者大赛作品介绍- dodice, diceos和Fox.one luckycoin
查看>>
中金易云:为出版社找到下一本《解忧杂货店》
查看>>
三篇文章了解 TiDB 技术内幕 —— 说计算
查看>>
copy strong weak assign的区别
查看>>
OpenCV 入门
查看>>
css 3D transform变换
查看>>
ele表格合并行之后的selection选中
查看>>
正则表达式分解剖析(一文悟透正则表达式)
查看>>
解决UILable标点符号居中的问题
查看>>
HTML5新特性教程
查看>>
ImageOptim-无损图片压缩Mac版
查看>>