4

I am trying to set saml2aws to provide temporary credentials for AWS services, specifically Codecommit. I have managed to install AWS CLI and saml2aws and got the credentials. But when current credentials expired I have faced 403. After a short dig, I discovered that the problem is osxkeychain

I set configurations as follow for --local, --global and --system

[credential]
    UseHttpPath = true
    helper = !aws --profile saml codecommit credential-helper $@

However, in my repository when I run

git config -l

The response reads as;

credential.helper=osxkeychain
credential.helper=!aws --profile saml codecommit credential-helper $@
credential.usehttppath=true
.
.
.
credential.helper=!aws --profile saml codecommit credential-helper $@
.
.
.
credential.usehttppath=true
credential.helper=!aws --profile saml codecommit credential-helper $@

The closest thing was disable git credential-osxkeychain but didn't help.

Any ideas?

oduvenci
  • 43
  • 5

1 Answers1

5

You can have multiple credential helpers configured in each config file, which explains why it has still there after you ran that config command at each level - you've just added a new config line rather than replacing the old one.

To see which config file it's in, run

git config --list --show-origin

Then you can remove it by manually editing the file.

If you don't have perms to file it's configured in, you can manually edit a tighter config file to look like:

[credential]
    helper =
    helper = !aws --profile saml codecommit credential-helper $@

The blank helper stops it falling back to helpers configured at higher levels of config

rbennett485
  • 1,907
  • 15
  • 24
  • Worked! I actually replaced the credential.helper in each level (`--local`,`--global`,`--system`) but the gitconfig file located in /Library/Developer/CommandLineTools/usr/share/git-core/ doesn't seem to be effected. now I manually edited that file to match above and worked. Thank you very much! – oduvenci Oct 07 '18 at 13:25
  • Wooooow, the other posts have so many upvotes and this one is the best answer :) – Hussain Alaidarous Jul 11 '19 at 09:32