如何更新Git的密码?

本文翻译自:How do I update the password for Git?

I'm using BitBucket with Xcode and Git for version control, and recently I changed all of my passwords ( thanks Adobe! ). 我正在使用BitBucket和Xcode以及Git进行版本控制,最近我更改了所有密码( 感谢Adobe! )。

Unsurprisingly, I'm no longer able to push my local commits to my repository on BitBucket ( Authentication failed for 'https://______.git' ), but I'm forgetting how to update the cached password on my iMac. 不出所料,我不再能够将我的本地提交推送到BitBucket上的存储库( Authentication failed for 'https://______.git' ),但我忘记了如何更新iMac上的缓存密码。 Somehow I've been unable to find it on Google or Stack Overflow, though it seems to me it should be rather straightforward... 不知怎的,我一直无法在Google或Stack Overflow上找到它,虽然在我看来它应该相当简单......


#1楼

参考:https://stackoom.com/question/1Mjii/如何更新Git的密码


#2楼

To fix this on macOS, you can use 要在macOS上修复此问题,您可以使用

git config --global credential.helper osxkeychain

A username and password prompt will appear with your next Git action (pull, clone, push, etc.). 用户名和密码提示将与您的下一个Git操作一起显示(拉,克隆,推送等)。

For Windows, it's the same command with a different argument: 对于Windows,它是具有不同参数的相同命令:

git config --global credential.helper wincred

#3楼

I had the same problem, and the accepted answer didn't help me because the password wasn't stored in the keychain. 我有同样的问题,并且接受的答案对我没有帮助,因为密码没有存储在钥匙串中。 I typed: 我键入:

git pull https://myuser@bitbucket.org/mypath/myrepo.git

Then console asked me for my new password. 然后控制台问我新密码。


#4楼

I would try to delete my account in Keychain Access and then run git clone again. 我会尝试在Keychain Access中删除我的帐户,然后再次运行git clone Git will ask me for a new password. Git会问我一个新密码。


#5楼

If you are MAC user then you can open KeyChain Access Application from finder and then look for your account listed there. 如果您是MAC用户,则可以从finder中打开KeyChain Access Application,然后查找其中列出的帐户。 Just click on it and update your password. 只需单击它并更新您的密码。 Now give a try and things will fall in place. 现在试一试,事情就会到位。

link for reference: Updating your credentials via Keychain Access 链接供参考: 通过Keychain Access更新您的凭据

Worked for me. 为我工作。 :) :)


#6楼

I was pushing into the repository for the first time. 我是第一次进入存储库。 So there was no HEAD defined. 所以没有定义HEAD

The easiest way would be to: 最简单的方法是:

git push -u origin master

It will then prompt for the password, and once you enter that it will be saved automatically, and you will be able to push. 然后它会提示输入密码,一旦你输入密码,它就会自动保存,你就可以推送了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值