How do I update the password for Git?

后端 未结 26 1897
一整个雨季
一整个雨季 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:41

    running git config --global --unset user.password followed by any git command would prompt you to enter username and password.

    git config --global --unset user.password
    git push (will prompt you for the password)
    git status (will not prompt for password again)
    
    0 讨论(0)
  • 2020-12-02 03:42

    To fix this on macOS, you can use

    git config --global credential.helper osxkeychain
    

    A username and password prompt will appear with your next Git action (pull, clone, push, etc.).

    For Windows, it's the same command with a different argument:

    git config --global credential.helper wincred
    
    0 讨论(0)
  • 2020-12-02 03:42

    None of the other answers worked for me on MacOS Sierra 10.12.4

    Here is what I had to do:

    git config --global --unset user.password
    

    Then run your git command (ex. git push) and reenter your username and password.

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

    you can change password through command line in 2 places, following would edit credentials to connect the repo

    git config --edit 
    

    The credentials also can be changed at global using global parameter like below

     git config --global --add user.password "XXXX"
    

    or set the credentials helper with

    git config --global credential.helper wincred
    

    but if you have repo level credentials set the use the first command

    git config --edit
    
    0 讨论(0)
  • 2020-12-02 03:44

    Just clone one of your existing repos, this will prompt you for new credentials:
    e.g.

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

    // https://myuser@bitbucket.org/mypath/myrepo.git is an address of one of your existing repos.

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

    There is such a confusion on this question, as there is way too much complexity in this question. First MacOS vs. Win10. Then the different auth mechanisms.

    I will start a consolidated answer here and probably need some help, if I do not get help, I will keep working on the answer until it is complete, but that will take time.

    Windows 10: | |--

    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.

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