Version Control part 3

Steven Klavins
4 min readFeb 28, 2020

Week 1 — Version control

GitHub

What is GitHub? GitHub is closely related to Git in the sense its also used to facilitate version control, however there’s a number of additional features that set it apart. GitHub is essentially a large host for all kinds of repositories, all kinds of projects with the emphasis on collaboration and open source code.

GitHub is a very valuable tool for numerous reasons, just some of those reasons being, you can use it to pull any of your projects onto any computer that has an internet connection. You also gain access to thousands of peoples code which you can either incorporate into projects or give your collaborate input. Just some of the open source libraries that are are hosted on GitHub include Bootstrap, Jquiry, Rust, Node.js and many more.

With GitHub you gain a lot of flexibility and connectivity with other members of the site, you’ll be able to find code for just about anything.

Getting set up with GitHub

Well first things first is to go it the site at https://github.com/ and sign up for a free membership (yep that’s right like Git its free!). You can find my GitHub profile at https://github.com/Steven-Klavins please feel free to have a look and see what I've been getting up to!

GitHub does have a GUI (a user friendly graphical user interface) however for the next few blogs i’m going to be using it on the command line.

Creating a repository

To create a repository on GitHub it is very easy, all you have to do is click the “+” in the top right hand of the site to display the drop down list and select “New repository ”. You will be prompted to answer if you would like the repository public or private, to assign the repository a name, add a README/description (optional) and then finally to create the repository.

SSH keys

Each time we submit a file to our online repository we will be prompted to enter our user name and password every time. As you can imagine this would get rather irritating after a while, not to threat we can use SSH keys to help us out. OK! important note here, if we are doing this on a windows computer we will need to use Git Bash in order to set this up. This should be available provided you installed the windows version of git, if you are using a Unix machine the default terminal should work fine

First run terminal or git bash “ssh-keygen -t rsa -b 4096 -C “youremail@emialtype.com” ” (-t = type, -b = bites -C = email). It is important you enter your GitHub email precisely here as you will not get a chance to confirm it. Following this you will press enter, and a public and private keygen pair will be created, one stays on your computer one is sent to GitHub. Press enter one more time to save your key to its default location, following this you will enter your passphrase/password. (Be careful not to press enter otherwise you will have no pass phrase set! When you enter your passphrase nothing will show on the screen, you carefully type it twice followed by enter).

So now we have done this we need to add the SSH key to the SSH agent, this is done as follows. “ eval “$(ssh-agent -s)”” follow by enter, followed by “ssh-add ~/.ssh/id_rsa” and press enter. You will now enter your password and that is your ssh key added, now we just need to link this to our GitHub account.

Login to GitHub and go to your settings, click on the tab SSH and GPG keys. Click “new SSH key”, you will now be prompted to add a name (for example “Steven’s Home Desktop”). Now all we need to do is copy over our SSH key, providing you saved this to its default location the command to copy it to your clipboard is “pbcopy < ~/.ssh/id_rsa.pub” for mac users, “clip < ~/.ssh/id_rsa.pub” for Windows users, for Linux users you will need to install xclip to do this. Finally we shall click SSH key which will complete the link to out GitHub, next time we push (upload)something to one of our GitHub repositories we will get a final message asking would we like to add the GitHub host to our trusted hosts list, type “Yes” and your SSH key is set up!

If there is any confusion around this subject please watch https://www.youtube.com/watch?v=H5qNpRGB7Qw it’s a really helpful tutorial!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Steven Klavins
Steven Klavins

Written by Steven Klavins

Hi, I’m Steven, most call me Steve! I’m a programmer, musician, and artist. This blog contains various tutorials and posts related to software development.

No responses yet

Write a response