GitHub:用户名或密码无效_password cannot include your login-程序员宅基地

技术标签: github  git  

本文翻译自:GitHub: invalid username or password

I have a project hosted on GitHub. 我有一个在GitHub上托管的项目。 I fail when trying to push my modifications on the master. 我试图推动我对主人的修改时失败了。 I always get the following error message 我总是收到以下错误消息

Password for 'https://[email protected]': 
remote: Invalid username or password.
fatal: Authentication failed for 'https://[email protected]/eurydyce/MDANSE.git/'

However, setting my ssh key to github seems ok. 但是,将我的ssh密钥设置为github似乎没问题。 Indeed, when I do a ssh -T [email protected] I get 的确,当我做一个ssh -T [email protected]我明白了

Hi eurydyce! You've successfully authenticated, but GitHub does not provide shell access.

Which seems to indicate that everything is OK from that side (eurydyce being my github username). 这似乎表明从那一方来说一切正常(eurydyce是我的github用户名)。 I strictly followed the instructions given on github and the recommendations of many stack discussion but no way. 我严格遵循github上给出的指令和许多堆栈讨论的建议,但没办法。 Would you have any idea of what I may have done wrong? 你知道我做错了什么吗?


#1楼

参考:https://stackoom.com/question/1yvWk/GitHub-用户名或密码无效


#2楼

https://[email protected]/eurydyce/MDANSE.git is not an ssh url, it is an https one (which would require your GitHub account name, instead of ' git '). https://[email protected]/eurydyce/MDANSE.git不是一个ssh url,它是一个https(需要你的GitHub帐户名,而不是' git ')。

Try to use ssh://[email protected]:eurydyce/MDANSE.git or just [email protected]:eurydyce/MDANSE.git 尝试使用ssh://[email protected]:eurydyce/MDANSE.git或者只是[email protected]:eurydyce/MDANSE.git

git remote set-url origin [email protected]:eurydyce/MDANSE.git

The OP Pellegrini Eric adds: OP Pellegrini Eric补充道:

That's what I did in my ~/.gitconfig file that contains currently the following entries [remote "origin"] [email protected]:eurydyce/MDANSE.git 这就是我在~/.gitconfig文件中所做的,其中包含当前以下条目[remote "origin"] [email protected]:eurydyce/MDANSE.git

This should not be in your global config (the one in ~/ ). 这不应该在你的全局配置中( ~/ )。
You could check git config -l in your repo: that url should be declared in the local config: <yourrepo>/.git/config . 您可以在您的仓库中检查git config -l :该url应该在本地配置中声明: <yourrepo>/.git/config

So make sure you are in the repo path when doing the git remote set-url command. 因此,在执行git remote set-url命令时,请确保您处于repo路径中。


#3楼

When using the https:// URL to connect to your remote repository, then Git will not use SSH as authentication but will instead try a basic authentication over HTTPS. 使用https:// URL连接到远程存储库时,Git不会使用SSH作为身份验证,而是尝试通过HTTPS进行基本身份验证。 Usually, you would just use the URL without a username, eg https://github.com/username/repository.git , and Git would then prompt you to enter both a username (your GitHub username) and your password. 通常,您只需使用不带用户名的URL,例如https://github.com/username/repository.git ,然后Git会提示您输入用户名(您的GitHub用户名)和密码。

If you use https://[email protected]/username/repository.git , then you have preset the username Git will use for authentication: something . 如果您使用https://[email protected]/username/repository.git ,那么您已预设Git将用于身份验证的用户名: something Since you used https://[email protected] , Git will try to log in using the git username for which your password of course doesn't work. 由于您使用了https://[email protected]将尝试使用您的密码当然不起作用的git用户名登录。 So you will have to use your username instead. 因此,您必须使用您的用户名。

The alternative is actually to use SSH for authentication. 替代方案实际上是使用SSH进行身份验证。 That way you will avoid having to type your password all the time; 这样你就不必一直输入你的密码; and since it already seems to work, that's what you should be using. 并且因为它似乎已经起作用,所以你应该使用它。

To do that, you need to change your remote URL though, so Git knows that it needs to connect via SSH. 为此,您需要更改远程URL,因此Git知道它需要通过SSH连接。 The format is then this: [email protected]:username/repository . 格式如下: [email protected]:username/repository To update your URL use this command: 要更新您的URL,请使用以下命令:

git remote set-url origin [email protected]:username/repository

#4楼

After enabling Two Factor Authentication (2FA), you may see something like this when attempting to use git clone , git fetch , git pull or git push : 启用双因素身份验证(2FA)后,您可能会在尝试使用git clonegit fetchgit pullgit push时看到类似的内容:

$ git push origin master
Username for 'https://github.com': your_user_name
Password for 'https://[email protected]': 
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/your_user_name/repo_name.git/'

Why this is happening 为什么会这样

From the GitHub Help documentation : GitHub帮助文档

After 2FA is enabled you will need to enter a personal access token instead of a 2FA code and your GitHub password. 启用2FA后,您需要输入个人访问令牌,而不是2FA代码和GitHub密码。

... ...

For example, when you access a repository using Git on the command line using commands like git clone , git fetch , git pull or git push with HTTPS URLs, you must provide your GitHub username and your personal access token when prompted for a username and password. 例如,当您使用Git git clonegit fetchgit pull或带有HTTPS URL的git push等命令在命令行上使用Git访问存储库时,在提示输入用户名和密码时,必须提供GitHub用户名和个人访问令牌。 。 The command line prompt won't specify that you should enter your personal access token when it asks for your password. 命令行提示符不会指定您在要求输入密码时应输入个人访问令牌。

How to fix it 如何解决它

  1. Generate a Personal Access Token . 生成个人访问令牌 (Detailed guide on Creating a personal access token for the command line .) (有关为命令行创建个人访问令牌的详细指南。)
  2. Copy the Personal Access Token. 复制个人访问令牌。
  3. Re-attempt the command you were trying and use Personal Access Token in the place of your password. 重新尝试您尝试的命令,并使用个人访问令牌代替您的密码。

Related question: https://stackoverflow.com/a/21374369/101662 相关问题: https//stackoverflow.com/a/21374369/101662


#5楼

just try to push it to your branch again. 只是尝试再次将其推送到您的分支机构。 This will ask your username and password again, so you can feed in the changed password. 这将再次询问您的用户名和密码,因此您可以输入更改的密码。 So that your new password will be stored again in the cache. 这样您的新密码将再次存储在缓存中。


#6楼

If like me you just updated your password and ran git push to run into this issue, then there's a super easy fix. 如果像我一样你刚刚更新了你的密码并运行git push来解决这个问题,那么就有一个非常简单的解决方法。

For Mac users only. 仅限Mac用户。 You need to delete your OSX Keychain access entries for GitHub. 您需要删除GitHub的OSX Keychain访问条目。 You can do it via terminal by running the following commands. 您可以通过运行以下命令通过终端执行此操作。

Deleting your credentials via the command line 通过命令行删除凭据

Through the command line, you can use the credential helper directly to erase the keychain entry. 通过命令行,您可以直接使用凭证帮助程序擦除钥匙串条目。

To do this, type the following command: 为此,请键入以下命令:

git credential-osxkeychain erase
host=github.com
protocol=https

# [Now Press Return]

If it's successful, nothing will print out. 如果成功,则不会打印出任何内容。 To test that it works, try and clone a repository from GitHub or run your previous action again like in my case git push . 要测试它是否有效,请尝试从GitHub克隆存储库,或者像我的git push一样再次运行您之前的操作。 If you are prompted for a password, the keychain entry was deleted. 如果系统提示您输入密码,则会删除钥匙串条目。

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/CHCH998/article/details/107406525

智能推荐

http隧道 java_使用java语言实现http隧道技术-程序员宅基地

文章浏览阅读119次。该楼层疑似违规已被系统折叠隐藏此楼查看此楼/***Getaparametervalue**@paramkeyString*@paramdefString*@returnString*/publicStringgetParameter(Stringkey,Stringdef){returnisStandalone?System.getProperty(ke..._java http隧道

Keepalived高可用+邮件告警_keepalived sendmail-程序员宅基地

文章浏览阅读913次。IP主机名备注192.168.117.14keepalived-master主节点192.168.117.15keepalived-slaver备节点192.168.117.100VIP1.主备节点均安装keepalived# yum install -y keepalived httpd2.主备节点均修改keepalived日志存放路径..._keepalived sendmail

SPFILE 错误导致数据库无法启动(ORA-01565)_ora01565 ora27046-程序员宅基地

文章浏览阅读469次。--==========================================--SPFILE错误导致数据库无法启动(ORA-01565)--========================================== SPFILE错误导致数据库无法启动 SQL> startup ORA-01078: failurein proce_ora01565 ora27046

功能测试基础知识(1)-程序员宅基地

文章浏览阅读6.1k次,点赞2次,收藏54次。功能测试基础知识总结_功能测试

postgresql 中文排序_pg中文排序-程序员宅基地

文章浏览阅读3.2k次,点赞3次,收藏2次。pg 中文首字母排序_pg中文排序

[Mysql] CONVERT函数_mysql convert-程序员宅基地

文章浏览阅读3.1w次,点赞23次,收藏109次。本文主要讲解CONVERT函数_mysql convert

随便推点

HTML5与微信开发(2)-视频播放事件及API属性_微信开发者工具视频快进-程序员宅基地

文章浏览阅读8.6k次,点赞2次,收藏2次。HTML5 的视频播放事件想必大家已经期待很久了吧,在HTML4.1、4.0之前我们如果在网页上播放视频无外乎两种方法: 第一种:安装FLASH插件或者微软发布的插件 第二种:在本地安装播放器,在线播放组件之类的 因为并不是所有的浏览器都安装了FLASH插件,就算安装也不一定所有的都能安装成功。像苹果系统就是默认禁用FLASH的,安卓虽然一开始的时候支持FLASH,但是在安卓4.0以后也开始不_微信开发者工具视频快进

JedisConnectionException Connection Reset_jedisconnectionexception: java.net.socketexception-程序员宅基地

文章浏览阅读5.4k次,点赞3次,收藏4次。在使用redis的过程常见错误总结1.JedisConnectionException Connection Reset参考这边文章:Connection reset原因分析和解决方案https://blog.csdn.net/cwclw/article/details/527971311.1问题描述Exception in thread "main" redis.clients...._jedisconnectionexception: java.net.socketexception: connection reset

Lua5.3版GC机制理解_lua5.3 gc-程序员宅基地

文章浏览阅读8.3k次,点赞8次,收藏42次。目录1.Lua垃圾回收算法原理简述2.Lua垃圾回收中的三种颜色3.Lua垃圾回收详细过程4.步骤源码详解4.1新建对象阶段4.2触发条件4.3 GC函数状态机4.4标记阶段4.5清除阶段5.总结参考资料lua垃圾回收(Garbage Collect)是lua中一个比较重要的部分。由于lua源码版本变迁,目前大多数有关这个方面的文章都还是基于lua5.1版本,有一定的滞后性。因此本文通过参考当前..._lua5.3 gc

手机能打开的表白代码_能远程打开,各种手机电脑进行监控操作,最新黑科技...-程序员宅基地

文章浏览阅读511次。最近家中的潮人,老妈闲着没事干,开始学玩电脑,引起他的各种好奇心。如看看新闻,上上微信或做做其他的事情。但意料之中的是电脑上会莫名出现各种问题?不翼而飞的图标?照片又不见了?文件被删了,卡机或者黑屏,无声音了,等等问题。常常让她束手无策,求助于我,可惜在电话中说不清,往往只能苦等我回家后才能解决,那种开心乐趣一下子消失了。想想,这样也不是办法啊, 于是,我潜心寻找了两款优秀的远程控制软件。两款软件...

成功Ubuntu18.04 ROS melodic安装Cartograhper+Ceres1.13.0,以及错误总结_ros18.04 安装ca-程序员宅基地

文章浏览阅读1.8k次。二.初始化工作空间三.设置下载地址四.下载功能包此处可能会报错,请看:rosdep update遇到ERROR: error loading sources list: The read operation timed out问题_DD᭄ꦿng的博客-程序员宅基地接下来一次安装所有功能包,注意对应ROS版本 五.编译功能包isolated:单独编译各个功能包,每个功能包之间不产生依赖。编译过程时间比较长,可能需要几分钟时间。此处可能会报错:缺少absl依赖包_ros18.04 安装ca

Harbor2.2.1配置(trivy扫描器、镜像签名)_init error: db error: failed to download vulnerabi-程序员宅基地

文章浏览阅读4.1k次,点赞3次,收藏7次。Haobor2.2.1配置(trivy扫描器、镜像签名)docker-compose下载https://github.com/docker/compose/releases安装cp docker-compose /usr/local/binchmod +x /usr/local/bin/docker-composeharbor下载https://github.com/goharbor/harbor/releases解压tar xf xxx.tgx配置harbor根下建立:mkd_init error: db error: failed to download vulnerability db: database download

推荐文章

热门文章

相关标签