running git clone against AWS CodeCommits gets me a 403 error

后端 未结 13 743
没有蜡笔的小新
没有蜡笔的小新 2021-01-31 14:56

My local laptop is a Mac.

  1. The ssh key is configured properly. This is the content of ~/.ssh/config

    Host barthea Hostname git-codecommit.us-east

相关标签:
13条回答
  • 2021-01-31 15:51

    My case in OSX.

    The first step:

    git config --global credential.helper '!aws codecommit credential-helper $@'
    git config --global credentials.helper UseHttpPath=true
    

    However, verifying git config --list --show-origin

    file:/usr/local/etc/gitconfig   credential.https://git-codecommit.eu-west-1.amazonaws.com.helper=!aws codecommit credential-helper $@
    file:/usr/local/etc/gitconfig   credential.helper=osxkeychain
    file:/Users/mine/.gitconfig  user.name=my-user
    file:/Users/mine/.gitconfig  user.email=my@gmail.com
    file:/Users/mine/.gitconfig  filter.lfs.clean=git-lfs clean -- %f
    file:/Users/mine/.gitconfig  filter.lfs.smudge=git-lfs smudge -- %f
    file:/Users/mine/.gitconfig  filter.lfs.process=git-lfs filter-process
    file:/Users/mine/.gitconfig  filter.lfs.required=true
    file:/Users/mine/.gitconfig  credential.helper=!aws codecommit credential-helper $@
    file:/Users/mine/.gitconfig  credential.usehttppath=true
    

    The first line was not present before, and git was using osxkeychain with precedence. Hence, I had to do git config --system ...

    cat /usr/local/etc/gitconfig                                             
    [credential "https://git-codecommit.eu-west-1.amazonaws.com"]
        helper = !aws codecommit credential-helper $@
        UseHttpPath = true
    [credential]
        helper = osxkeychain
    

    So the URL was specified in order to fallback in case another credentials are stored.

    Update https://docs.aws.amazon.com/codecommit/latest/userguide/troubleshooting-ch.html

    For some reason, UseHttpPath = true seems not to be added sometimes. So it can (should) be added under [credential]

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