I am running a CodeBuild on a project that has private requirements stored in CodeCommit.
I need to add a command in buildspec.yml
that loads the https git credentials so git clone
works when CodeBuild runs pip install
.
The build fails with fatal: could not read Username for 'https://git-codecommit.us-west-2.amazonaws.com': No such device or address
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