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

智能推荐

Pycharm中出现Comparison with None performed with equality operators-程序员宅基地

文章浏览阅读4.5k次,点赞7次,收藏7次。Pycharm中出现Comparison with None performed with equality operators_comparison with none performed with equality operators

2017年全国大学生电子设计竞赛综合测评题目解析——2022更新(方波生成,方波分频,三角波,加法器,滤波器,正弦波))_17电赛综测题解析-程序员宅基地

文章浏览阅读1.1w次,点赞5次,收藏50次。这里写自定义目录标题一、题目二、方案设计三、具体参数设计1.方波 12.方波 23.三角波4.合成波5.正弦波使用Multisim 14仿真,文件可联系博主获取。2017 年电子设计竞赛综合测评一、题目二、方案设计使用给定的共计 4 个运算放大器和 1 个数字芯片双 D 触发器,完成 5 个波形,其中:(1)使用 1 个运放产生 20 KHz 的方波 1,搭建 RC 振荡电路和滞回比较器,该电路比较重要,既可以产生方波,也可以产生三角波,可以用于方波发生器和三角波发生器;(2)使用 74LS_17电赛综测题解析

国基北盛 openstack 云平台搭建保姆级步骤_国基北盛openstack-程序员宅基地

文章浏览阅读3.3k次,点赞17次,收藏69次。国基北盛 openstack 云平台搭建保姆级步骤_国基北盛openstack

简单解释一下SDK、JDK、JRE、JVM之间的区别以及联系_sdk和jdk的关系-程序员宅基地

文章浏览阅读1.3k次。一、JDK与JRE简单的说:JDK是面向开发人员使用的SDK,它提供了Java的开发环境和运行环境。SDK是Software Development Kit 一般指软件开发包,可以包括函数库、编译程序等。JDK就是Java Development KitJRE是Java Runtime Enviroment是指Java的运行环境,是面向Java程序的使用者,而不是开发者。如果..._sdk和jdk的关系

Flex DateField 日期范围_flex中datefiled显示年月-程序员宅基地

文章浏览阅读941次。<![CDATA[ import mx.controls.DateField; [Bindable] private var today:Date = new Date(new Date()

ROS学习笔记8(使用 rqt_console, rqt_graph 和 roslaunch)_launch实现rqt——graph-程序员宅基地

文章浏览阅读2.9k次。本教程介绍如何使用rqt_console和rqt_logger_level进行调试,以及如何使用roslaunch同时运行多个节点。文章目录1 用rqt_console和rqt_logger_level日志等级说明2 使用roslaunchlaunch文件roslaunch1 用rqt_console和rqt_logger_levelrqt_console属于ROS日志框架(logging ..._launch实现rqt——graph

随便推点

《卸甲笔记》-PostgreSQL和Oracle的SQL差异分析之五:函数的差异(六)_postgresql lnnvl-程序员宅基地

文章浏览阅读786次。PostgreSQL是世界上功能最强大的开源数据库,在国内得到了越来越多机构和开发者的青睐和应用。随着PostgreSQL的应用越来越广泛,Oracle向PostgreSQL数据库的数据迁移需求也越来越多。数据库之间数据迁移的时候,首先是迁移数据,然后就是SQL、存储过程、序列等程序中不同的数据库中数据的使用方式的转换。下面根据自己的理解和测试,写了一些SQL以及数据库对象转换方面的文章,不足之处..._postgresql lnnvl

在centos-8环境下使用Kubespray部署Kubernetes生产集群-程序员宅基地

文章浏览阅读876次,点赞15次,收藏27次。在centos-8环境下使用Kubespray部署Kubernetes生产集群

计算机应用基础课本前言,计算机应用基础探析-程序员宅基地

文章浏览阅读336次。摘要:《计算机应用基础》是中职学校学生必修的公共基础课。本文通过对中职计算机应用基础教学过程中如何通过培养学生正确的学习态度,激发学生的学习兴趣,优化授课内容,采用适当的教学方法,以提高中职学校学生计算机基本应用技能,满足其学习和实际应用需求提出了一些个人看法和建议。关键词:中职学校 计算机应用基础 中职学生 教学方法1、前言中等职业教育是一个特殊的教育类型。它不同于以理论知识为主、以升学为目的普..._计算机应用基础前言

element中的el-form里面如果不用el-button,用button的话,要在button放在el-form外面_el-button可以用button代替吗-程序员宅基地

文章浏览阅读1.5k次。问题现象:第一次录入时,如果漏填了必填项,点击提交按钮。会刷新界面,所有已填内容都未保存上问题代码:问题分析:在form中的button默认的时候点击时间会执行form的提交事件(相当于默认为submit类型);如果需要阻止它,方法有:(1)将button的type修改为:type=button解决方法:原来的button换成el-button。或者将button放在el-form外面。..._el-button可以用button代替吗

Docker-compose安装mysql_docker-compose 安装 mysql-程序员宅基地

文章浏览阅读847次。本系列文章主要介绍使用docker-compose部署mysql,nginx,redis等中间件,前后分离微服务项目部署流程。不介绍docker安装以及基础命令,话不多说首先进入mysql安装教学。_docker-compose 安装 mysql

【记】自定义切面导致的事务失效问题_切面导致事务失效-程序员宅基地

文章浏览阅读2.2k次,点赞2次,收藏3次。自定义切面导致的事务失效问题1、问题引出在本地测试中,发现在一段被@Transaction注解标注的方法即使抛出了RunTimeException,数据库依然会有新的记录产生,也就是事务没有回滚,代码如下:多次检查事务相关都没有的配置都没有问题,然后在Spring的事务方法中,打上断点,看下具体的执行逻辑:后来发现,retVal = invocation.proceedWithInvocation(); 执行完后,没有进cache代码块,而是直接进入commitTransactionAfterR_切面导致事务失效

推荐文章

热门文章

相关标签