git 远程:无效的用户名或密码,致命:身份验证失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24998233/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
remote: Invalid username or password, fatal: Authentication failed for
提问by Rahil
I have just clone repo an then make one commit add it and was trying to push it - but have this error:
我刚刚克隆了 repo,然后进行一次提交添加它并试图推送它 - 但有这个错误:
Any ideas how can I fix this evill?
任何想法如何解决这个邪恶?
采纳答案by VonC
If you want to push to https://github.com/AntonDerenivsky/lado, you should use the credentials of AntonDerenivsky.
如果你想推送到https://github.com/AntonDerenivsky/lado,你应该使用 AntonDerenivsky 的凭据。
Using 'fresa
' would only work if fresa
has been declared as collaboratorfor AntonDerenivsky/lado
repo.
fresa
仅当fresa
已被声明为AntonDerenivsky/lado
repo 的合作者时, 才可以使用“ ” 。
Or you need to fork that repo, and use:
或者你需要fork 该 repo,并使用:
git remote rename origin upstream
git remote add origin https://[email protected]/fresa/lado
git push -u origin master
If AntonDerenivsky is your gitHub account, the the login to use is 'AntonDerenivsky', not 'fresa'.
如果 AntonDerenivsky 是您的 gitHub 帐户,则使用的登录名是“AntonDerenivsky”,而不是“fresa”。
回答by Mark Haferkamp
I had the same problem with my first GitHub repository just now. In my case, the problem was related to having enabled two-factor authentication. I had GitHub make an authentication token since the command line tools aren't aware of two-factor authentication.
我刚刚在我的第一个 GitHub 存储库中遇到了同样的问题。就我而言,问题与启用双因素身份验证有关。我让 GitHub 制作了一个身份验证令牌,因为命令行工具不知道双因素身份验证。
The problem was that double-clicking the token to select it somehow selected a space to its left as well, resulting in me copying an invalid code. Carefully click-dragging from one end of the token to the other worked.
问题是双击令牌以选择它以某种方式选择了它左边的一个空格,导致我复制了一个无效的代码。小心地从令牌的一端单击拖动到另一端工作。
回答by Suraj
If you have changed your password, you can use
如果您更改了密码,您可以使用
git remote show origin
This will prompt for a username and password wherein you can enter your credentials.
这将提示您输入用户名和密码,您可以在其中输入您的凭据。
回答by lfender6445
Regarding two factor authentication - after re-enabling 2fa I had to delete and re-add the remote endpoint for git to successfully pull.
关于两因素身份验证 - 重新启用 2fa 后,我必须删除并重新添加远程端点,以便 git 成功拉取。
# ERROR: Repository not found.
# fatal: Could not read from remote repository.
# copy and paste ssh destination [email protected]:user/repo.git
git remote -v
git remote remove origin
git remote add origin [email protected]:user/repo.git
回答by lengqi
maybe you change your password.
I has the same problem,then use upstairs method works.
Remember to replace url [email protected]:user/repo.git
by yourself.
也许您更改了密码。我有同样的问题,然后使用楼上的方法有效。记得自己替换url [email protected]:user/repo.git
。
git remote -v
git remote remove origin
git remote add origin [email protected]:user/repo.git