2. Accounts and Keys#

In this lab you’ll generate SSH keys (if you don’t have them already) and upload your public key to GitHub and Google Cloud. Doing this will enable you to use your GitHub repositories and simplify the process of SSH-ing into Google Instances.

Create a GitHub Account#

A GitHub account is required for this course. GitHub accounts are free and you are required to have one because some of your work will be submitted there. Also, GitHub provides the most convenient way to build and publish Docker images. Without GitHub the process would be much more tedious for you.

Generate a Key Pair#

Danger

Don’t do this if you have keys already! It will overwrite them.

You should have a key pair on your local machine, though you may want another one depending on how you configure your development environment. To generate a key pair:

Note

You don’t need a password on your SSH key if it’s on a machine that only you use.

$ ssh-keygen -t ed25519 

Your key pair will be in ~/.ssh/id_ed25519 and ~/.ssh/id_ed25519.pub. To view your public key so that you can copy and paste it into GitHub run this command:

$ cat ~/.ssh/id_ed25519.pub

Upload your Key to GitHub#

Follow these two guides on GitHub:

  1. Add a new SSH key

  2. Test the SSH connection

Put Your Key in Google Cloud#

Follow the instructions in this guide to adding SSH keys to Google projects.

Set Your Local Git Identity#

The git program needs to know who you are. Run these two commands, substiuting your information:

$ git config --global user.name "Your Name"
$ git config --global user.email you@example.com