-
-
Save m0veax/0105fb4eece52279d6df6fec9ca890e3 to your computer and use it in GitHub Desktop.
A quick way to transfer a file to the home directory on a Vagrant VM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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?" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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