I\'m having a hard time copying files over to my Google Compute Engine. I am using an Ubuntu server on Google Compute Engine.
I\'m doing this from my OS X terminal a
The updated solution for this exact issue (2020)
For the sake of exposition, we have to break the issue in two parts. The "copy-files" command is officially depreciated and we are to use "scp", however both old and new options are limited to certain folders only.
Since we do have access to the /tmp folder, this means we can easily move our distribution files with the preferred "scp" command, as a staging step.
More importantly we also have access to execute scripts, or commands remotely via SSH on the instance which means the limited access is no longer an issue.
Example Time
The first part is to copy the dist folder, and all it's content recursively to the tmp folder to which gloud does give access:
gcloud compute scp --recurse dist user_name@instance:/tmp
The second part leverages the fact that we can run commands remotely via ssh:
gcloud compute ssh user_name@instance --command "sudo bash golive"
(or any other command you may need to execute)
More importantly this also means that we can just copy our distribution files to the final destination using sudo and the "cp" copy function:
gcloud compute ssh user_name@instance --command "sudo cp -rlf /tmp/dist/* /var/www/html/"
This completely eliminates the need to set the permissions first through the ssh terminal.