Let’s get started

Antoine Jaussoin
Around the App in 365 days
6 min readMar 2, 2018

If you have a dream, you can spend a lifetime studying, planning, and getting ready for it. What you should be doing is getting started.
Drew Houston

In our previous articles, we learned how to set up our computer and get all the tools we needed to start our project.

In this article, we will create our repository on GitHub, explain what a SSH key is and clone our brand new repository on our machine so we can start coding.

Creating a Git repository on GitHub

First, if you haven’t already done so, you will need to create an account on GitHub. If you already have one, please login.

Then, on the top right corner, click the + icon and select New repository.

You can then pick a name for your repository, a description, and then click on Create repository.

A repository can be Public (accessible to anybody), or Private (accessible to you and your team). Public repositories are free, but you need to pay for a Private one.

If you wish to have a free Private repository, I would recommend using Bitbucket instead.

You should now see an (almost) empty repository, ready to be cloned.

I say almost because you can see three files in there:

  • .gitignore is a file that contains a list of files and folder that should be ignored by Git. By ignore I mean that these files, or folders, can be created on your computer but will never be added to the Git repository itself. This will be explained in more details in a later article.
  • LICENCE is a file that contains the licence for your project. If you look closely to the previous screenshot, you can see that we chose the MIT Licence here but you can chose something else.
  • README.md is a Markdown file that is displayed at the root of this project. Below the file list, the content you see (with the title and the “A planning poker tool” sentence) is actually written in the README.md file. This is were we are going to add instructions and documentation on our project.

A little SSH digression

Now that we have a brand new repository on GitHub, we are going to clone it on our PC so we can start working on it.

You have two different ways of cloning with Git: SSH and HTTPS. The later, HTTPS, might be easier to use the first time, but might be a bit less secure: you need to provide your GitHub credentials when you want to push your changes, and it will ask for these credentials regularly which can be a pain.

SSH is a bit harder to setup at first, but once it’s done, you don’t need to specify credentials anymore, for any repository on GitHub.

SSH works by creating a pair of private and public keys on your computer, and by giving your public key to GitHub: this way, GitHub can trust your computer when you connect via SSH.

Creating your SSH keys

  • Open a Terminal window
  • You should land on your home directory, but in doubt, do cd ~/
  • Then create the .ssh directory: mkdir .ssh
  • Go into that directory: cd .ssh
  • And then paste the following command (replace the email by your own):
ssh-keygen -t rsa -b 4096 -C “email@email.com

This will yield a series of questions:

The first question will be about where to store the keys, just hit enter and it will store it in the default location which is what we want.

The second will be about setting up a passphrase: this is not compulsory, but this is highly recommended. The purpose of this is, if someone steals your private key, that they wouldn’t be able to use it without the passphrase.

Once this is done, the command will have created two files:

  • id_rsa: this is the private key, this should never leave your computer
  • id_rsa.pub: this is the public key, this is the one you need to share with the computers you want to communicate with. GitHub in that case.

We are now going to provide your public key to GitHub: first, let’s copy the content of the key to your clipboard: still in the .ssh directory, do:

cat id_rsa.pub

This command will display the content of the file in the Terminal, so you can just copy the content of the file to your clipboard.

Then, go to GitHub and in the Settings:

Then on the SSH and GPG keys section, click on New SSH key

And then paste the content of your key, (the title can be anything), and click “Add SSH key”.

Now GitHub knows your identity and will allow you to clone your repository using SSH. Hooray!

Hello Dolly

Now that we have a brand new repository on GitHub, and brand new SSH keys, we are going to clone the repo on our PC so we can start working on it.

First, let’s grab the repo’s SSH URL: Go to your project main page, and click on Clone or download:

A little popup should open, make sure it says Clone with SSH (and not Clone with HTTPS), and copy the URL below: it should start with git@github.com.

Then open a Terminal window, CD to your dev directory, and issue the following command (replace the URL by the one you copied before of course):

git clone git@github.com:yourusername/yourproject.git

If you did add a passphrase to your SSH key, it might ask for it now, but it should be a one-of. Also, if it is the first time you are using this SSH key with GitHub (as it should be), it will ask you to confirm the fingerprint: just type yes and you are good to go.

Your repository is now cloned on your local machine, and you can open it with Visual Studio Code by doing:

cd nameofyourproject/
code .

You are ready to code!

Next week, we will create our first React application in this repository.

--

--