Skip to content

Instantly share code, notes, and snippets.

@bewie
Forked from colindean/vagrant-scp.sh
Last active August 29, 2015 14:22
Show Gist options
  • Save bewie/52104a27b13883fc1196 to your computer and use it in GitHub Desktop.
Save bewie/52104a27b13883fc1196 to your computer and use it in GitHub Desktop.
#!/bin/sh
OPTIONS=`vagrant ssh-config | awk -v ORS=' ' '{print "-o " $1 "=" $2}'`
scp ${OPTIONS} "$@" || echo "Transfer failed. Did you use 'default:' as the target?"
#!/bin/bash
PORT=2222
if [ ${VAGPORT} ]; then
PORT=${VAGPORT}
fi
VAGRANT_GEM=$(dirname `gem which vagrant`)/..
VAGRANT_KEY=${VAGRANT_GEM}/keys/vagrant
chmod 600 ${VAGRANT_KEY}
ssh -i ${VAGRANT_KEY} -p ${PORT} vagrant@localhost
#need to test this:
#OPTIONS=`vagrant ssh-config | awk -v ORS=' ' '{print "-o " $1 "=" $2}'`;
#ssh ${OPTIONS} localhost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment