1

I am wanting to clone a git repo using the git resource in Chef but instead of SSH like everywhere seems to show I want to use just username/password. The security of the repo is not important but don't want public as it is not a great example of my work.

Currently this is what I have:

git 'My private repo' do
  repository 'https://<username>:<password>@github.com/<username>/<repo name>.git'
  reference 'master'
  action :sync
end
  • Howdy Josh, welcome to DevOps. Is there a technical reason you wouldn't want to use ssh keys instead of username/password? – chicks Sep 2 '18 at 11:43
  • @chicks No technical reason no, just a preference to use username/password since I have always found that easier and the username/password is stored in chef vault which is fairly secure and would like to use that method. – Josh Kirby Sep 2 '18 at 23:23
  • I'd really encourage you to spend some time setting up ssh keys. Github makes it relatively easy. You can store the private key in chef and deploy it with cookbooks. In the long term it will be easier for you. – chicks Sep 2 '18 at 23:38
  • @chicks I might look into the eventually but for now passwords is good enough. I was just hoping for a quick solution and since I couldn't figure it out I went with a bash resource and a git clone command. I do agree SSH keys are likely a better way, just time and desire to learn git with SSH isn't there.Thanks for the idea though and will add it to the list to figure out in time. – Josh Kirby Sep 2 '18 at 23:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.