This question already has an answer here:
- Git authentication in Chef 6 answers
I am new to all this but I am guessing I will be using SSH keys ... but how?
git '/home/vagrant/foo' do
repository 'me@repo.domain.com:/usr/git/app.git'
reference 'master'
action :sync
user "vagrant"
group "vagrant"
end
Here what worked for me:
1 - Generate a SSH key pair (public + private)
The public key you will add to your
git
repo2 - Generate a key for encryption
3 - Create an encrypted data bag with knife
This will open your favorite editor (vim), you will then needs to add your private key:
IMPORTANT: Replace the newlines of your private key by \n
4 - In your recipe:
5 - Look inside your encrypted data bag
6 - Add your public key to your node
7 - Verify you can connect to BitBucket
IMPORTANT: At the end of this command, you will have the
known_hosts
file that you need to add to your cookbook. Copy it tofiles/default
folder of your cookbook.After this I was about to
git clone
my repository.I think I have documented exactly what I have done, but feel free to drop your questions.