如何更新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://[email protected]/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. 然後它會提示輸入密碼,一旦你輸入密碼,它就會自動保存,你就可以推送了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章