How do I update the password for Git?

后端 未结 26 1900
一整个雨季
一整个雨季 2020-12-02 03:12

I\'m using BitBucket with Xcode and Git for version control, and recently I changed all of my passwords (thanks Adobe!).

Unsurprisingly, I\'m no longer able

相关标签:
26条回答
  • 2020-12-02 03:45

    Tried everything but nothing worked. Then the following did work.

    1. Before any of the above steps, lock and unlock the keychain again coz sometimes it sorta gets stuck.
    2. Install the GitHub Desktop — it helps.
    0 讨论(0)
  • 2020-12-02 03:46

    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.

    0 讨论(0)
  • 2020-12-02 03:46

    If your credentials are stored in the credential helper, the portable way to remove a password persisted for a specific host is to call git credential reject:

    $ git credential reject
    protocol=https
    host=bitbucket.org
    ⏎
    

    or

    $ git credential reject
    url=https://bitbucket.org
    ⏎
    

    After that, to enter your new password, type git fetch.

    0 讨论(0)
  • 2020-12-02 03:46

    For MAC users, using git GUI (Works for Sourcetree, may work for others as well). Would like to add a small remark to Derek's answer (https://stackoverflow.com/a/45703718/7138492). The original suggestion:

    $ git config --global --unset user.password
    

    should be followed by a push/pull/fetch BUT it might not work when done from the GUI. The %100 working case would be to do the very first consecutive prompt-triggering git command from console. Here is an example:

    1. Locate to your git repository root directory
    2. Type in $ git config --unset user.password
    3. Proceed with a git commend of your choice in terminal e.g.: $ git push

    Then it will ask you to provide the new passoword.

    0 讨论(0)
  • 2020-12-02 03:48

    For Mac

    If you have multiple remote repositories (Github, Bitbucket, Job, etc.)

    1) run in the project directory

    git config --unset user.password
    

    2) run remote git command (ie. git push or git pull)

    Git will prompt you to reenter your user.name and user.password for this repository

    Or you can do it globally if you have only one remote repository

    git config --global --unset user.password
    
    0 讨论(0)
  • 2020-12-02 03:48

    my password was good in github desktop preferences but wrong in the .git/config file

    for me the only working solution was to manually edit the file: .git/config

    that contains this line: url = https://user:password@github.com/user/repo.git

    change password to the GOOD password because it was an older one for me

    0 讨论(0)
提交回复
热议问题