datalass1 / fastai

this repo will show code and notes covered during the fastai course
0 stars 0 forks source link

ssh keys for GitHub and scp to GCP #20

Closed datalass1 closed 5 years ago

datalass1 commented 5 years ago

What ssh keys exist: $ ls -al ~/.ssh

Generating a new SSH key:

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

Adding your SSH key to the ssh-agent

Start the ssh-agent in the background: $ eval "$(ssh-agent -s)" Add your SSH private key to the ssh-agent: $ ssh-add ~/.ssh/id_rsa

Add the SSH key to the GitHub account:

Copy the SSH key to your clipboard:

$ sudo apt-get install xclip
$ xclip -sel clip < ~/.ssh/id_rsa.pub

On GitHub go to profild pic > settings > SSH and GPG keys > New SSH key > Add SSH key

source

datalass1 commented 5 years ago

Transferring files from Linux instances to local repo

Transferring files using the gcloud command-line tool gcloud compute scp jupyter@my-fastai-instance:~/tutorials/fastai/course-v3/nbs/dl1/lesson1v3-pets-20190131.ipynb ~/home/ubuntu/git/fastai/dl1/

An error: ERROR: (gcloud.compute.ssh) Could not fetch resource: - Insufficient Permission

The solution: It looks like the attempt to SSH is recognising the instance in your project, but the user doesn't have the required permissions to access the machine. Run: $ gcloud auth login And completing the web-based authorization to ensure you are attempting to access the machine as the correct (authenticated) user.

Another error: ERROR: (gcloud.compute.scp) Could not fetch resource:

Tried on local and VM: gcloud config list compute/region to view the region gcloud config set compute/region us-west2 to set a new region

To see the full GCP config for a project: gcloud config list To change zone: gcloud config set compute/zone us-west2-b

Finally: gcloud compute scp jupyter@my-fastai-instance:~/tutorials/fastai/course-v3/nbs/dl1/lesson1v3-pets-20190131.ipynb ~/git/fastai/dl1/

helpful pages: change region and zone change metadata how to transfer files to instances