This post is the first part of a mini series which I have written to aid in setting up and using your Codespaces.com Git repository remotely on Windows.
- Getting started; setting up your SSH Public Key (this article)
- Pushing your code into the hosted repository
- Pulling your code from the hosted repository
Getting started
To start off you need to download and install msysgit which will give you the basics; make sure you include the “Git bash” and “Git Gui” options during the installation.
SSH key creation
First step to working with Codespaces repositories, or any remote git repositories, is to create a ssh key. This is done by using the git bash shell. The shortcut looks like this:
Once the bash shell has loaded you will be presented with a command line interface similar to a linux/unix command line.
Type ‘ssh-keygen’ and something similar to the following will appear. Leave it with the default locations as this will aid in locating the files later.
The process will ask you for your passphrase. Remember this as you will be prompted for it every time you want to perform actions on the remote repository.
Once the file is created you will be returned to the command prompt. At this point locate the file in the location where it was originally specified - in my case c:\users\west\.ssh - and you will find two files; “id_rsa” and “id_rsa.pub”.
Open the id_rsa.pub file in notepad (other plain text editors are available) and minimise as you will need this in a few minutes.
Log into your Codespaces.com dashboard and navigate to “My Profile” and then “SSH Keys”.
This is where you will need the notepad instance you minimised earlier. Copy the contents of the file and paste into the “Key Value” text box. Set the value of the “Key Name” to something appropriate; for this example I have called it “Public”.
One thing to note, make sure you remove any additional carriage returns from the end of the key value entered value. Once you are happy with this click “Add Key”. If this has been saved successfully you will be notified and the key will be listed on the right hand side.
This action will have performed what you need for encryption keys to allow access between your computer and remote Codespace repository. Please keep the keys safe and secure as you don’t want any unauthorised people getting access.
Conclusion
In this post we have created our ssh keys and added them to our Codespaces.com account information to allow for remote access.
Next time we’ll be pushing our local repository code into the remote repository.
No comments:
Post a Comment