Reputation: 11
I am trying to transfer a folder from my local machine to a VM in gcp
I am running
gcloud auth login
gcloud config set account 'my-gmail-account'
sudo gcloud compute scp path/to/folder $VM_ID:$REMOTE_DIR --project=$PROJECT_ID --recurse
It keeps giving me the error below even though I have logged in to the correct account. This problem has never happened when I am running on spare mac computer but it occurs on my ubuntu (I am not even sure if it is an os related issue).
ERROR: (gcloud.compute.scp) You do not currently have an active account selected.
Please run:
$ gcloud auth login
to obtain new credentials.
If you have already logged in with a different account:
$ gcloud config set account ACCOUNT
Upvotes: 1
Views: 7526
Reputation: 76073
The config file are stored in a location related to your user (~/.config/gcloud/
).
If you change the current user, you change the current user-config location. In your code you configure GCLOUD with your user account and you use it with the ROOT account. It fails, it's normal.
Perform all your command with sudo, or without. But not mix the two.
Upvotes: 3