Git authentication in Chef

前端 未结 6 1554
眼角桃花
眼角桃花 2020-12-14 02:11

When deploying an application with Chef, I\'ve got the code base set to be cloned from a private github repository with the following resource:

git \'/mnt/ap         


        
6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-14 02:33

    Based on the hint by sadaf2605, this was the easiest way for me – I just had to make sure to set the correct user/group as well as turn off StrictHostKeyChecking:

    git '/path/to/destination' do
      environment 'GIT_SSH_COMMAND' => 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /path/to/private_key'
      repository 'git@github.com:your/repo.git'
      reference 'master'
      action :sync
      user 'vagrant'
      group 'vagrant'
    end
    

提交回复
热议问题