Ken*_*rty 444 git macos change-password
我正在使用BitBucket和Xcode以及Git进行版本控制,最近我更改了所有密码(感谢Adobe!).
不出所料,我不再能够在BitBucket(Authentication failed for 'https://______.git'
)上将我的本地提交推送到我的存储库,但我忘记了如何更新我的iMac上的缓存密码.不知怎的,我一直无法在Google或Stack Overflow上找到它,虽然在我看来它应该相当简单......
Ken*_*rty 736
要在macOS上修复此问题,您可以使用
git config --global credential.helper osxkeychain
Run Code Online (Sandbox Code Playgroud)
用户名和密码提示将与您的下一个Git操作一起显示(拉,克隆,推送等).
对于Windows,它是具有不同参数的相同命令:
git config --global credential.helper wincred
Run Code Online (Sandbox Code Playgroud)
小智 426
在MacOS Sierra 10.12.4上,没有其他答案对我有用
这是我必须做的:
git config --global --unset user.password
Run Code Online (Sandbox Code Playgroud)
然后运行你的git命令(例如git push)并重新输入你的用户名和密码.
Imr*_*ved 280
在带有Git的Windows 10中
删除/更新存储在Windows控制面板\所有控制面板项目\凭据管理器中的Windows凭据中的相关凭据
bom*_*om1 148
我可以修改我的git密码的唯一方法是转到Windows中的凭据管理器(Windows密钥+类型'凭据')并编辑Windows凭据通用凭据下的git条目.注意:不按字母顺序列出
Jul*_*nez 79
我有同样的问题,并且接受的答案对我没有帮助,因为密码没有存储在钥匙串中.我键入:
git pull https://myuser@bitbucket.org/mypath/myrepo.git
Run Code Online (Sandbox Code Playgroud)
然后控制台问我新密码.
nzr*_*tmn 63
在@Imran Javed上面提到的Windows 10中,您可以在以下位置找到Generic Credentials:
控制面板\所有控制面板项目\凭据管理器 - > Windows凭据
对于您的git服务器,然后您可以通过单击编辑按钮更新密码.
And*_*rey 49
对于 Mac
如果您有多个远程存储库(Github、Bitbucket、Job 等)
1)在项目目录下运行
git config --unset user.password
Run Code Online (Sandbox Code Playgroud)
2) 运行远程 git 命令(即 git push 或 git pull)
Git 会提示你为这个仓库重新输入你的用户名和用户密码
或者,如果您只有一个远程存储库,则可以全局执行此操作
git config --global --unset user.password
Run Code Online (Sandbox Code Playgroud)
Shr*_*thy 27
运行git config --global --unset user.password
任何git命令后,都会提示您输入用户名和密码。
git config --global --unset user.password
git push (will prompt you for the password)
git status (will not prompt for password again)
Run Code Online (Sandbox Code Playgroud)
Nis*_*ant 15
如果您是MAC用户,则可以从finder中打开KeyChain Access Application,然后查找其中列出的帐户.只需单击它并更新您的密码.现在试一试,事情就会到位.
链接供参考:通过Keychain Access更新您的凭据
为我工作.:)
小智 15
在我的Windows机器上,我尝试了@nzrytmn的解决方案,即控制面板>搜索凭据>选择git选项类别下与我的用户名对应的“ ManageCredentials“>修改后的新凭据。然后,
删除当前密码:
git config --global --unset user.password
Run Code Online (Sandbox Code Playgroud)
添加了新密码:
git config --global --add user.password "new_password"
Run Code Online (Sandbox Code Playgroud)
它为我工作。
Rap*_*nel 15
如果您使用 github 并启用了 2 因素身份验证,则需要输入个人访问令牌而不是密码
首先重置密码:
git config --global --unset user.password
然后,登录到您的 github 帐户,在右上角,单击设置,然后单击开发人员设置。生成个人访问令牌。复制它。
git push
终端将提示您输入用户名:输入您的电子邮件地址。
在密码提示下,输入个人访问令牌。
use*_*338 14
在这个问题上存在如此混乱,因为这个问题太复杂了。第一个 MacOS 与 Win10。然后是不同的身份验证机制。
我将在这里开始一个统一的答案,可能需要一些帮助,如果我没有得到帮助,我将继续努力直到答案完成,但这需要时间。
视窗 10: |
|-- Run this command. You will be prompted on next push/pull to enter username and password:
| git config --global credential.helper wincred (Thanks to @Andrew Pye)
Run Code Online (Sandbox Code Playgroud)
` MacOS:
|
|-- Using git config to store username and password:
| git config --global --add user.password
|
|---- first time entry
| git config --global --add user.password <new_pass>
|
|---- password update
| git config --global --unset user.password
| git config --global --add user.password <new_pass>
|
|-- Using keychain:
| git config --global credential.helper osxkeychain
|
|---- first time entry
| Terminal will ask you for the username and password. Just enter it, it will be
| stored in keychain from then on.
|
|---- password update
| Open keychain, delete the entry for the repository you are trying to use.
| (git remote -v will show you)
| On next use of git push or something that needs permissions, git will ask for
| the credentials, as it can not find them in the keychain anymore.
`
Run Code Online (Sandbox Code Playgroud)
Pri*_*jee 13
我是第一次进入存储库.所以没有HEAD
定义.
最简单的方法是:
git push -u origin master
Run Code Online (Sandbox Code Playgroud)
然后它会提示输入密码,一旦你输入密码,它就会自动保存,你就可以推送了.
小智 13
如果您的凭据存储在凭据帮助程序中,则删除为特定主机保留的密码的便携式方法是调用git credential reject
:
$ git credential reject
protocol=https
host=bitbucket.org
?
Run Code Online (Sandbox Code Playgroud)
或者
$ git credential reject
url=https://bitbucket.org
?
Run Code Online (Sandbox Code Playgroud)
之后,要输入新密码,请键入git fetch
。
Dan*_*ard 11
在 MacOS Big Sur 11.3.1 上没有其他答案对我有用
我在 Github 上启用了双因素身份验证,这使得即使输入用户名和密码正确,您也会失败。
这是我必须做的:
git config --global --unset user.password
Run Code Online (Sandbox Code Playgroud)
然后运行您的 git 命令(例如 git push)并输入您的用户名。对于密码,您需要生成个人访问令牌。
去
https://github.com/settings/profile
选择Developer Settings
右边的。选择Personal Access Token
Generate new token
。复制生成的令牌并将其用作终端中的密码。
Scr*_*die 11
鉴于 2021 年 8 月 13 日起的新令牌身份验证要求,这可能是您正在寻找的:
git remote remove origin
git remote add origin https://[TOKEN]@github.com/[USER]/[REPO]
git push
Run Code Online (Sandbox Code Playgroud)
对于 MacOS,根据自 2021 年 8 月 13 日起使用密码令牌的新规则。
我尝试了所有其他基于终端的答案,但没有一个有效。
小智 8
您可以在 2 个地方通过命令行更改密码,以下将编辑凭据以连接 repo
git config --edit
Run Code Online (Sandbox Code Playgroud)
凭证也可以使用全局参数在全局更改,如下所示
git config --global --add user.password "XXXX"
Run Code Online (Sandbox Code Playgroud)
或设置凭据助手
git config --global credential.helper wincred
Run Code Online (Sandbox Code Playgroud)
但是如果你有 repo 级别的凭据设置使用第一个命令
git config --edit
Run Code Online (Sandbox Code Playgroud)
我的密码在 github 桌面首选项中正确,但在.git/config
文件中错误
对我来说唯一有效的解决方案是手动编辑文件:
.git/config
包含这一行:
url = https://user:password@github.com/user/repo.git
Run Code Online (Sandbox Code Playgroud)
将密码更改为良好的密码,因为它对我来说是旧密码
在终端中执行以下步骤:
删除Mac中保存的当前密码
git config --global --unset user.password
Run Code Online (Sandbox Code Playgroud)使用以下命令添加新密码,并替换为新密码:
git config --global --add user.password <new_pass>
Run Code Online (Sandbox Code Playgroud)我可以通过转到 Windows 中的凭据管理器并删除 Windows 凭据通用凭据下的所有 git 条目来更改我的 git 密码。
在执行 git pull 或 git push 时,windows 会要求输入新的用户/密码本身。
只需克隆您现有的存储库之一,这将提示您输入新的凭据:
例如
git clone https://myuser@bitbucket.org/mypath/myrepo.git
Run Code Online (Sandbox Code Playgroud)
(其中https://myuser@bitbucket.org/mypath/myrepo.git
是您现有存储库之一的地址)
小智 5
在 mac BigSur 11.2.3 上,我更新了钥匙链中的凭据,然后运行了以下命令。
git credential-osxkeychain erase
host=github.com
protocol=https
Run Code Online (Sandbox Code Playgroud)
我必须这样做,因为在更改为 github 的令牌身份验证后,该线程中没有其他解决方案对我有用。github一直提示找不到存储库。如果这不起作用,请尝试将其与此线程中的其他 mac 命令结合起来。