Setting credentials for https git clone in AWS CodeBuild Setting credentials for https git clone in AWS CodeBuild git git

Setting credentials for https git clone in AWS CodeBuild


Since the CodeBuild environment uses an IAM role for credentials (not a username and password), you will need to configure the CodeCommit credential helper in your buildspec:

phases:  install:    commands:      - git config --global credential.helper '!aws codecommit credential-helper $@'      - git config --global credential.UseHttpPath true


CodeBuild now provides an easier dial for this buildspec by setting the "git-credential-helper" to yes. Documentation @ https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec-ref-syntax


You can use de credentils helper from git, you can put the following commands into builspec pipeline

phases:  install:    commands:        - echo "https://username:password@bitbucket.org" > ~/.git-credentials    - git config credential.helper 'store'

Git documentation https://git-scm.com/docs/git-credential-store