Search code examples
amazon-web-serviceschef-infratest-kitchen

Clone aws codecommit repo using chef


How can i clone aws codecommit repo with chef recipe?

I tried installing AWS CLI and added credentials with codecommit access, then use chef’s git resource to clone the repo. but it fails with could not read Username for ‘https://git-codecommit.us-east-1.amazonaws.com’ .

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

When tried to clone from the command line it works.

helps would be appreciated


Solution

  • First, make sure you have correct Access key ID and Secret access key in IAM -> users -> Security Credentials. Second, put [credential] helper = !aws codecommit credential-helper $@ UseHttpPath = true into .gitconfig file. Third, Both .gitconfig file and .aws directory should in the /root/ . Maybe this is the problem that you have. You put the .gitconfig in the /root/.aws/, which will make credential helper useless. Thus it is asking your Username/Password.

    If you have done all the things above, it also fails, I suggest you to use ssh to clone the repository. Follow this documentation http://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-ssh-unixes.html