VVV
VVV copied to clipboard
Clone a private Bitbucket repo over SSH
Expected Behavior
clone the repo as part of a site-provisioning
Current Behavior
its a private bitbucket repo. i shared my private key within the box and authenticated with it. bitbucket.org is part of the known_hosts file. if i ssh in the box i can clone the repo. (logged in as the vagrant user). in the site-provisioning it fails (its logged in as the vagrant user aswell). It says "Host key verification failed."
Possible Solution
Dont know what i can try to make this work. The exact same command (git clone --recursive --branch ${BRANCH} ${REPO} ${VM_DIR}) works outside of the site-provisioning.
Steps to Reproduce (for bugs)
- setup a new site in vvv-config.yml
- set a private ssh repo url
- start the site provisioning "vagrant provision --provision-with site-{site}"
Your Environment
- VVV version: 2.0.0
- Vagrant version: 1.8.7
- VM Provider name: VirtualBox
- VM Provider version: 5.1.8
- Operating System and version: OSX newest version
site provisioning runs as the root user, either:
- add the host to the root known hosts file and add the key on your host with
ssh-add
- add
noroot
before the git command to run it as the vagrant user
Thank you for the clarification! it works now. i was just confused because when i logged who -H from provision-site.sh it said "vagrant" and not root.
is there any particular reason/benefit that the clone command is without noroot? Same as all the wp cli commands. Why add the flag --allow-root instead of noroot? As it is now, i install a wpcli dotenv package to init the .env file within the init.sh script. In that case i can only access the dotenv commands as root user.
I ran into similar problems trying to get provisioning working with a private repo. My host environment is a Windows10 machine.
I could fix the issue by also generating id_rsa keys for the root user of the vagrant machine, and adding them as well to BitBucket, or your Git provider of choice.
this should work via the folders:
feature and SSH Agent forwarding in modern VVV