How to change remote git repositories credentials?

Answered

Hi, recently I added a remote origin to a git repo I'm working on, but the credentials I used were wrong. Every time I try to add the remote it tries to connect and throws a 403 error. I don't know where to change or reset them. I already chose the option "do not store passwords" in settings -> passwords but still nothing. Please any help is appreciated. Thanks!

3 comments
Comment actions Permalink

IDE uses command line git, which itself can cache credentials. What happened, I believe, that git saved wrong credentials and tries using it in the background, without asking IDE what creds to use.

See https://git-scm.com/docs/gitcredentials

Check the output of the followng command executed in the corresponding repository:

git config credential.helper

It will show you what helper is in use. Usually, it is default keychain. Then you could clear wrong credentials from the helper, or totally disable it to let IDE handle passwords.

2
Comment actions Permalink

Thanks Dmitriy, that command put me in the right direction. Executing showed nothing on my console, so I added the credential store like this:

git config --global credential.helper credential-store

Then after pushing via console and entering the right credentials it worked. In the end it wasn't the IDE's fault but the way git does things. Thank you!

0
Comment actions Permalink

Ran into the exact same thing, this solved it for me (https://help.github.com/articles/updating-credentials-from-the-osx-keychain/):

$ git credential-osxkeychain erase
host=[host, in my case git-codecommit.us-west-2.amazonaws.com]
protocol=[protocol, in my case, https]
[Press Return]

 

0

Please sign in to leave a comment.