在AWS CodeBuild中为https git clone设置凭证 [英] Setting credentials for https git clone in AWS CodeBuild
问题描述
我正在对具有私人要求存储在CodeCommit中的项目上运行CodeBuild.
I am running a CodeBuild on a project that has private requirements stored in CodeCommit.
我需要在 buildspec.yml
中添加一条命令,以加载https git凭据,以便当CodeBuild运行 pip install
时, git clone
可以工作.
I need to add a command in buildspec.yml
that loads the https git credentials so git clone
works when CodeBuild runs pip install
.
构建失败,错误代码为:致命:无法读取"https://git-codecommit.us-west-2.amazonaws.com"的用户名:没有此类设备或地址
The build fails with fatal: could not read Username for 'https://git-codecommit.us-west-2.amazonaws.com': No such device or address
推荐答案
由于CodeBuild环境使用IAM角色作为凭据(而不是用户名和密码),因此您需要配置
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
这篇关于在AWS CodeBuild中为https git clone设置凭证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!