git 远程:无效的用户名或密码。致命:身份验证失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40957380/
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
提问by mrseanbaines
I'm just getting started with Git/Github and I'm completely stuck. I'm using Terminal on Mac/OSX El Capitan and when it asks for password it tells me it is invalid, but I am entering the same password that I created for my GitHub account, so surely this should work? What am I doing wrong?
我刚刚开始使用 Git/Github,我完全被困住了。我在 Mac/OSX El Capitan 上使用终端,当它要求输入密码时,它告诉我它无效,但我输入的密码与我为 GitHub 帐户创建的密码相同,所以这肯定可以工作吗?我究竟做错了什么?
Last login: Sun Dec 4 10:46:35 on ttys000
Seans-MBP:~ mrseanbaines$ git push -u origin master
Username for 'https://github.com': mrseanbaines
Password for 'https://[email protected]':
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/mrseanbaines/cartwheeling-kitten.git/'
Seans-MBP:~ mrseanbaines$
回答by amoljdv06
I had faced same issue.
Solution:
Step 1: Control Panel
Step 2: Credential Manager
Step 3: Click Window Credentials
Step 4: In Generic Credential section ,there would be git url, edit and update username and password
Step 5: Restart Git Bash and try for clone
我遇到了同样的问题。
解决方案:
第1步:控制面板
第2步:凭据管理器
第3步:单击窗口凭据
第4步:在通用凭据部分,将有git url,编辑并更新用户名和密码第5步:重新启动Git Bash并尝试克隆
回答by Do Nhu Vy
(1)Go to https://github.com/settings/security, turn off Two-factor authentication.
(1)前往https://github.com/settings/security,关闭两步验证。
(2)Create a new folder, inside the new folder:
(2)新建一个文件夹,在新文件夹里面:
git clone https://github.com/mrseanbaines/cartwheeling-kitten.git
cd cartwheeling-kitten
Open empty source code directory, since you use macOS, type
打开空的源代码目录,因为你使用的是macOS,输入
open .
(3)Copy your source code to folder cartwheeling-kitten(it's the opening folder)
(3)将您的源代码复制到文件夹carwheeling-kitten(这是打开文件夹)
(4)Config
(4)配置
git config user.name "Your full name"
git config user.email "Your_email_address_what_used_to_register Github_account"
(5)Add remote URL
(5)添加远程 URL
git remote add upstream https://github.com/mrseanbaines/cartwheeling-kitten.git
(6)Add to stage, then push
(6)添加到stage,然后push
git add -A .
git commit -m "Upload source code"
git push -u origin master
(7)Go to https://github.com/mrseanbaines/cartwheeling-kittensee result.
(7)去https://github.com/mrseanbaines/cartwheeling-kitten查看结果。
回答by Uday Sravan K
If you already have setup SSH key in your system for some other git account then just do these steps https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/
如果您已经在系统中为其他一些 git 帐户设置了 SSH 密钥,那么只需执行以下步骤https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/
and check activation using ssh -T [email protected]
if you see 'Hi GitAccountUserName! You've successfully authenticated, but GitHub does not provide shell access.'
并检查使用激活ssh -T [email protected]
,如果你看到“嗨GitAccountUserName!您已成功通过身份验证,但 GitHub 不提供 shell 访问。
Then continue your previous work.
然后继续你之前的工作。
回答by yelsayed
Make sure your remote urls are correct. It looks like you're missing the protocol, it should be: https://github.com/mrseanbaines/cartwheeling-kitten.git
. You can verify this by cloning the repo to another directory, and trying git operations there.
确保您的远程网址正确无误。看起来您缺少协议,它应该是:https://github.com/mrseanbaines/cartwheeling-kitten.git
。您可以通过将 repo 克隆到另一个目录并在那里尝试 git 操作来验证这一点。
If you want to fix it to add the protocol, you can do: git remote set-url origin https://github.com/mrseanbaines/cartwheeling-kitten.git
如果要修复它以添加协议,可以执行以下操作: git remote set-url origin https://github.com/mrseanbaines/cartwheeling-kitten.git
回答by Ravi Pullagurla
When I tried to push the code into remote repo from local (macbook), I faced the same issue after PASSWORD reset on GHE website.
当我尝试将代码从本地(macbook)推送到远程仓库时,我在 GHE 网站上重置密码后遇到了同样的问题。
$ git push -u origin coffee_shop_autorization
$ git push -u origin coffee_shop_autorization
remote: Invalid username or password.
远程:无效的用户名或密码。
fatal: Authentication failed for 'https://github.com/ravinderreddy-p/FSND.git/'
致命:“ https://github.com/ravinderreddy-p/FSND.git/”的身份验证失败
Then I followed below simple steps to fix this issue:
然后我按照以下简单的步骤来解决这个问题:
I cloned another repository from GHE to local in different folder:
- I switched to this folder by 'cd bookshelf'
I tried to push the same without making any changes as below:
git push
- It prompted for Username for 'https://github.com':<Provide your GHE user name> then press enter.
- It prompted as Password for 'https://[email protected]': <provide updated password on GHE> then press enter
- You will see this message as "Everything up-to-date"
我将另一个存储库从 GHE 克隆到不同文件夹中的本地:
- 我通过' cd bookshelf'切换到这个文件夹
我尝试在不做任何更改的情况下推送相同的内容,如下所示:
推
- 它提示输入“ https://github.com”的用户名:<提供您的 GHE 用户名>,然后按 Enter。
- 它提示为“ https://[email protected]”的密码:<在GHE上提供更新的密码>然后按回车
- 您将看到此消息为“一切都是最新的”
All Done.
全部完成。
Now go to your previous local repo where you tried to push the code into remote and execute your previous command
现在转到您之前尝试将代码推送到远程的本地存储库并执行您之前的命令
git push -u origin coffee_shop_autorization
git push -u origin coffee_shop_autorization
It will push the code into remote repo and you can see similar as below (with your repo and branch details):
它会将代码推送到远程仓库中,您可以看到如下所示的内容(包含您的仓库和分支详细信息):
Enumerating objects: 35, done.
枚举对象:35,完成。
Counting objects: 100% (27/27), done.
计数对象:100% (27/27),完成。
Delta compression using up to 4 threads
使用多达 4 个线程的增量压缩
Compressing objects: 100% (14/14), done.
压缩对象:100% (14/14),完成。
Writing objects: 100% (15/15), 2.47 KiB | 843.00 KiB/s, done.
写入对象:100% (15/15),2.47 KiB | 843.00 KiB/s,完成。
Total 15 (delta 8), reused 0 (delta 0)
总计 15 个(增量 8),重复使用 0 个(增量 0)
remote: Resolving deltas: 100% (8/8), completed with 5 local objects.
远程:解析增量:100% (8/8),完成 5 个本地对象。
remote:
偏僻的:
remote: Create a pull request for 'coffee_shop_autorization' on GitHub by visiting:
远程:通过访问在 GitHub 上为“coffee_shop_autorization”创建拉取请求:
remote: https://github.com/ravinderreddy-p/FSND/pull/new/coffee_shop_autorization
远程:https: //github.com/ravinderreddy-p/FSND/pull/new/coffee_shop_autorization
remote:
偏僻的:
To https://github.com/ravinderreddy-p/FSND.git
到https://github.com/ravinderreddy-p/FSND.git
- [new branch] coffee_shop_autorization -> coffee_shop_autorization Branch 'coffee_shop_autorization' set up to track remote branch 'coffee_shop_autorization' from 'origin'.
- [新分支]coffee_shop_autorization->coffee_shop_autorization 分支'coffee_shop_autorization' 设置为从'origin' 跟踪远程分支'coffee_shop_autorization'。