远程:无效的用户名或密码。致命的:身份验证失败

问题描述:

我刚刚开始使用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$ 
+0

你的遥控器的外观如何(输出'git remote -v')?你使用两个因素认证? – yelsayed

+0

@yBot上次登录:太阳12月4日11时51分27秒上ttys000 Seans-MBP:〜mrseanbaines $ git的远程-v 起源\t https://github.com/mrseanbaines/cartwheeling-kitten.git(取) 来源\t https://github.com/mrseanbaines/cartwheeling-kitten.git(推送) Seans-MBP:〜mrseanbaines $ 如何检查是否启用了两个因子认证? – Sean

+0

你有没有试过用这些用户名/密码在github上登录? – pedrorijo91

确保您的远程URL是正确的。看起来你错过了协议,它应该是:https://github.com/mrseanbaines/cartwheeling-kitten.git。你可以通过将repo克隆到另一个目录来验证这一点,并在那里尝试git操作。

如果你要修复它添加的协议,你可以这样做:git remote set-url origin https://github.com/mrseanbaines/cartwheeling-kitten.git

(1)转到https://github.com/settings/security,关闭双因素身份验证

(2)创建新文件夹,在新文件夹:

git clone https://github.com/mrseanbaines/cartwheeling-kitten.git 
cd cartwheeling-kitten 

开放空源代码目录中,由于使用的MacOS,类型

open . 

(3)将您的源代码复制到文件夹cartwheeling-kitten(它是开始文件夹)

(4)配置

git config user.name "Your full name" 
git config user.email "Your_email_address_what_used_to_register Github_account" 

(5)添加远程URL

git remote add upstream https://github.com/mrseanbaines/cartwheeling-kitten.git 

(6)添加到阶段,然后推

git add -A . 
git commit -m "Upload source code" 
git push -u origin master 

( 7)转到https://github.com/mrseanbaines/cartwheeling-kitten看到结果。

+0

我遵循了你的指示,但在'git push -u origin master'之后,它向我询问用户名和密码。看起来是这样的: https://snag.gy/cqNOts.jpg ......和GitHub的页面仍然是这样的: https://snag.gy/nhKacb.jpg 我进入后密码会在没有“Seans-MBP:”的情况下进入下一行,并且似乎没有任何事情发生,但是如果我尝试关闭终端,则好像它正在执行某些操作。看起来像这样: https://snag.gy/t1q9lv.jpg – Sean

如果你已经有安装SSH密钥系统中的一些其他git的帐户,然后就去做这些步骤https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/

,并使用ssh -T [email protected] 检查激活,如果你看到“嗨GitAccountUserName!您已成功通过身份验证,但GitHub不提供shell访问权限。'

然后继续你以前的工作。