我正在尝试推送到远程存储库。远程源是一个https链接。然而,当我尝试推送时,我得到了输入用户名的提示,然后一个OpenSSH弹出窗口要求输入我的密码。在输入我的密码(或个人访问令牌)后,我收到错误消息
remote: Password authentication is not available for Git operations.
remote: You must use a personal access token or SSH key.
remote: See https://******/settings/tokens or https://******/settings/ssh
fatal: unable to access 'https://******': The requested URL returned error: 403git配置文件如下所示。特别是,所有的链接看起来都是https,而不是ssh,所以我不知道为什么OpenSSH要密码。上周我能够推动,(据我所知)我没有改变任何事情。从那时起,我就再也没有去过其他地方了。
core.symlinks=false
core.autocrlf=true
core.fscache=true
help.format=html
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
rebase.autosquash=true
push.default=simple
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
user.name=******
user.email=******
user.username=******
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
remote.origin.url=https://******
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master发布于 2018-11-23 08:08:17
该错误消息是因为您的帐户设置了双因素身份验证(或可能的单点登录)。启用2FA后,GitHub不再允许您使用密码进行身份验证。
您可以选择使用SSH密钥推送到您的帐户,也可以创建个人访问令牌,以代替HTTPS的密码。如果您使用的是Windows,则可以使用内置的凭据助手将该令牌加密存储在Windows凭据存储区中,这样您只需输入一次。
由于看起来您使用的是GitHub或GitHub企业实例,请注意,如果您希望令牌访问私有存储库(对于公共存储库,则为"public_repo“),则令牌至少需要包含"repo”权限,并且如果您的组织使用单点登录系统,则必须启用single sign-on for that token。如果选择使用SSH,则必须为SSH密钥启用SSO (如有必要)。
您看到OpenSSH askpass窗口的原因是,即使您没有使用SSH,也是因为Git for Windows利用该工具提示您输入密码,因此您不需要输入终端。
发布于 2018-11-22 07:12:32
首先,确保使用git config -l考虑所有的git配置。
和grep for指令,这可能会改变InsteadOf中的https URL,或者相反。
git config -l | grep -i insteadof然后,检查(对于HTTPS URL)您的凭据缓存,其中Git将默认提供旧帐户/密码(缓存)的凭据(GitHub帐户和密码)。
看看您是否有一个缓存了您的(旧帐户)凭据(用户名/密码)的,用于验证您的身份。
git config credential.helper 在Mac上,作为Arpit J的commented,只需转到/打开你的钥匙链访问->搜索github.com相关文件->并在那里编辑凭证。

参见"Updating credentials from the OSX Keychain“
例如,在Windows上,这就是Windows Credential Managers。
打开Windows凭据存储区,查看第一个用户是否已在其中注册:删除该条目,您就可以使用第二个用户进行身份验证。
(这里是BitBucket的一个示例)

在命令行中,作为seen here
git credential reject protocol=https host=github.com
然后设置新的用户名和密码:
git credential fill protocol=https host=github.com
输入git help credential查看详细信息。
https://stackoverflow.com/questions/53372238
复制相似问题