0
votes

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

1
What user did you add the credentials for? Remember that Chef is generally running as root so any creds would go in /root/.coderanger
Hello, the aws credential and .gitconfig are stored under, /root/.aws/Vishnu Prassad
The credentials have to be in your git config, /root/.aws/ wouldn't do anything.coderanger
i have this in .gitconfig, [credential] helper = !aws codecommit credential-helper $@ UseHttpPath = trueVishnu Prassad
and it works when I run the clone command locally.Vishnu Prassad

1 Answers

0
votes

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