running git clone against AWS CodeCommits gets me a 403 error

后端 未结 13 730
没有蜡笔的小新
没有蜡笔的小新 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:34

    This helpful text is found on the AWS documentation for codecommit and Windows integration

    If your installation of Git for Windows included the Git Credential Manager utility, you will see 403 errors or prompts to provide credentials into the Credential Manager utility after the first few connection attempts. The most reliable way to solve this problem is to uninstall and then reinstall Git for Windows without the option for the Git Credential Manager utility, as it is not compatible with AWS CodeCommit.

    If you want to keep the Git Credential Manager utility, you must perform additional configuration steps to also use AWS CodeCommit, including manually modifying the .gitconfig file to specify the use of the credential helper for AWS CodeCommit when connecting to AWS CodeCommit.

    Remove any stored credentials from the Credential Manager utility (you can find this utility in Control Panel).

    Once you have removed any stored credentials, add the following to your .gitconfig file, save it, and then try connecting again from a new command prompt window:

    [credential "https://git-codecommit.us-east-1.amazonaws.com"]
        helper = !aws codecommit credential-helper $@
        UseHttpPath = true
    

    Additionally, you might have to re-configure your git config settings by specifying --system instead of --global or --local before all connections work as expected.

    This last part applied to my situation, though when I ran git config --system it did not function as expected but appended aws configure before the aws codecommit command.

    So I had to run this in git to find the location of the config file for the system.

    git config --list --show-origin
    

    I then added the suggested section from AWS to both my c:/users/username/.gitconfig and my c:/ProgramData/Git/config files.

    After that git push started working- even though I get the bogus error in front of my response of

    "git: 'credential-aws' is not a git command. See 'git --help'."
    

提交回复
热议问题