Github OpenSSH要求输入https链接的密码 [英] Github OpenSSH asking for password for an https link

查看:103
本文介绍了Github OpenSSH要求输入https链接的密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试推送到远程存储库.远程源是一个https链接.但是,当我尝试推送时,提示输入我的用户名,然后一个OpenSSH弹出窗口要求输入密码.输入密码(或个人访问令牌)后,出现错误消息

I'm attempting to push to a remote repository. The remote origin is an https link. However when I attempt to push I get a prompt for my username, and then an OpenSSH popup window asks for my password. After entering my password (or a personal access token) I get the error

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: 403

下面是git配置文件.特别是所有链接看起来都是https,而不是ssh,所以我不知道为什么OpenSSH要求输入密码.上周我能够推动,并且(据我所知)我什么都没改变.从那时起,我当然再也没有推销过任何其他产品了.

The git config file is below. In particular all the links look to be https, and not ssh, so I don't know why OpenSSH is asking for a password. I was able to push last week and (as far as I know) I haven't changed anything. I certainly haven't pushed anywhere else since then.

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

推荐答案

该错误消息是因为您的帐户设置了两因素身份验证(或可能是单点登录).启用2FA后,GitHub不再允许您使用密码进行身份验证.

The error message is because your account has two-factor authentication (or possibly single sign-on) set up. When you have 2FA enabled, GitHub no longer lets you use your password to authenticate.

您可以选择使用SSH密钥推送到您的帐户,也可以创建个人访问令牌,该令牌可以代替HTTPS密码使用.如果您使用的是Windows,则可以使用内置的凭据帮助器将加密的令牌存储在Windows凭据存储中,因此只需输入一次即可.

You can either choose to use an SSH key to push to your account, or you can create a personal access token, which can be used in place of a password for HTTPS. If you're on Windows, you can use the built-in credential helper to store that token encrypted in the Windows Credential Store so you only need to enter it once.

由于您似乎正在使用GitHub或GitHub企业实例,因此请注意,如果您希望令牌访问私有存储库(对于公共存储库,则为"repo")(对于公共存储库,则为"public_repo"),并且如果您的组织使用单一登录系统,则必须启用

Since it looks like you're using GitHub or a GitHub enterprise instance, note that the token needs to contain at least the "repo" permission if you want it to access private repositories (or "public_repo" for public ones), and if your organization uses a single sign-on system, you must enable single sign-on for that token. If you choose to use SSH, you must similarly enable SSO for your SSH key if necessary.

即使您未使用SSH,也看到OpenSSH Askpass窗口的原因是因为Git for Windows利用该工具提示您输入密码,因此您无需输入终端.

The reason you're seeing the OpenSSH askpass window even though you're not using SSH is because Git for Windows leverages that tool to prompt you for your password so you don't need to enter a terminal.

这篇关于Github OpenSSH要求输入https链接的密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆