【问题标题】:Clone aws codecommit repo using chef使用 Chef 克隆 aws codecommit 存储库
【发布时间】:2018-06-07 11:20:30
【问题描述】:

如何使用厨师食谱克隆 aws codecommit 存储库?

我尝试安装 AWS CLI 并添加具有 codecommit 访问权限的凭证,然后使用 chef 的 git 资源来克隆 repo。但它失败,无法读取“https://git-codecommit.us-east-1.amazonaws.com”的用户名。

git "/home/ubuntu/lead_intake" do
  repository node[:app_name][:git_repository]
  action :sync
end

当尝试从命令行克隆时,它可以工作。

帮助将不胜感激

【问题讨论】:

  • 您为哪个用户添加了凭据?请记住,Chef 通常以 root 身份运行,因此任何凭据都会进入 /root/
  • 您好,aws 凭证和 .gitconfig 存储在 /root/.aws/ 下
  • 凭证必须在你的 git 配置中,/root/.aws/ 不会做任何事情。
  • 我在 .gitconfig 中有这个,[credential] helper = !aws codecommit credential-helper $@ UseHttpPath = true
  • 当我在本地运行克隆命令时它可以工作。

标签: amazon-web-services chef-infra test-kitchen


【解决方案1】:

首先,确保您在 IAM -> users -> Security Credentials 中拥有正确的访问密钥 ID 和秘密访问密钥。 其次,将 [credential] helper = !aws codecommit credential-helper $@ UseHttpPath = true 放入 .gitconfig 文件中。 第三, .gitconfig 文件和 .aws 目录都应该在 /root/ 中。也许这就是您遇到的问题。您将 .gitconfig 放在 /root/.aws/ 中,这将使凭证助手无用。因此它询问您的用户名/密码。

如果你做了上面所有的事情,它也失败了,我建议你使用 ssh 克隆存储库。按照这个文档http://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-ssh-unixes.html

【讨论】:

  • 谢谢。它有帮助:)
猜你喜欢
  • 2020-06-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-03-07
  • 2022-12-11
  • 2019-05-18
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多