user1700890
user1700890

Reputation: 7730

gcloud compute scp error: All sources must be local files

I tried to copy file from my google cloud instance to local machine with the following command:

gcloud compute scp nlp-2:to_test.txt C:\Temp

And got back the following error message:

ERROR: (gcloud.compute.scp) All sources must be local files when destination is remote.  Got sources: [nlp-2:to_test.txt], destination: 
C:Temp

What is exactly wrong? I am confident that the same command worked like 2 days ago.

Update: I am connecting to Ubuntu 16.04 (google instance) from Win 7 (local machine)

Upvotes: 5

Views: 6331

Answers (3)

Amirkhm
Amirkhm

Reputation: 1096

You may like to use as it worked for me:

in my case every file was in the folder jupyter!

gcloud beta compute scp --project "project_name" --zone "zone_name" instance_name:~jupyter/file_name /home/Downloads

Upvotes: 1

Pedro Ramírez
Pedro Ramírez

Reputation: 21

In order to resolve copying files to the instance, I had to create a path in D: (in your case can be C:) the same as the one represented by ~ in the ubuntu instance (/home/example_name/) and put the files to copy in that windows directory:

sudo gcloud beta compute scp --project="projectname" --zone="zonename" ~/Filename.zip instancename:~/

The reason is because the console scp does not support :

Upvotes: 2

GalloCedrone
GalloCedrone

Reputation: 5067

I have just tried to replicate the issue running the following code on a Google Cloud SDK Shell from a machine with Windows Server 2008 R2:

gcloud compute scp instance-1:/home/username/file C:\Users\username\file2

where instance-1 is a Debian 4.9.51-1 and I have been able to copy the file.

Therefore I think you misspelled something writing the command (also because you wrote that it was working for you as well some days ago) or I didn't understand correctly your configuration. If this is the case an you provide some information more editing the question?

EDIT

I tested as well to do SCP between Debian machine having "weird" names and I have been always able to copy the files both from a remote location and to a remote location:

gcloud compute scp instance-1:/paolo '/C:\\Temp'

and

gcloud compute scp instance-2:'/C:\\Temp' .

Note despite the weird notation that C:\Temp is a file stored in a Linux instance

Upvotes: 1

Related Questions