Search code examples
gitamazon-web-servicesamazon-iamgitkrakenaws-codecommit

clone AWS codecommit repo via HTTP


I have set 2 repositories in AWS Codecommit and using before SourceTree from Windows, setting up access via HTTP protocol was and everything was working fine.

Right not I am migrating the development of a project on a machine where I do have installed ubuntu and where I choose to use gitkraken.

I was able to git clone in a folder where my user has read and write access(my user) via Terminal, so isn't permission related in Ubuntu, where after git clone "aws repo url" I was prompt asking for the username for the IAM and password(the one created at AWS IAM console).

I can of course open that repo folder from gitkraken and see even all the remote branch and all the history, but once I do for example pull from gitkraken it failed as "access" denied. I cannot also clone the same or another repo from Gitkraken. So seems I do have to configure my credentials in gitkraken but not sure where that should be done. This official doc does not say much.


Solution

  • I actually found that I was able to connect, and previously I was failing because not following some steps quite hide in the AWS Codecommit docs:

    I am not sure if giving the following at prompt are necessary steps, but I guess they do not hurt:

    At terminal provide the following:

    aws configure
    

    you will be prompt to provide:

    AWS Access Key ID

    AWS Secret Access Key

    Default region name

    Default output format

    Till here I do recommend to provide the above

    After on clone "your https AWS address" your_repo_name, you are prompted to provide an username and a password. Unfortunately for both my root account and my IAM account(with correct rules policy) I got 403 error.

    What was successful, without provide additional credential was to execute at terminal the following:

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

    then simply:

    clone https://your_url_code your_repo_name for HTTPS connection from AWS Codecommit console
    

    For more detailed instruction refer to the official docs

    This worked for me.