VVV icon indicating copy to clipboard operation
VVV copied to clipboard

Clone a private Bitbucket repo over SSH

Open dseidl opened this issue 7 years ago • 3 comments

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)

  1. setup a new site in vvv-config.yml
  2. set a private ssh repo url
  3. 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

dseidl avatar Mar 26 '17 15:03 dseidl

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

LoreleiAurora avatar Mar 26 '17 19:03 LoreleiAurora

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.

dseidl avatar Mar 26 '17 21:03 dseidl

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.

rlaan avatar May 05 '17 15:05 rlaan

this should work via the folders: feature and SSH Agent forwarding in modern VVV

tomjn avatar Jan 19 '23 16:01 tomjn