Open Source

Open-source projects are those kinds of software whose source code is available to the public and free to use. They are regularly maintained by individuals that give their time freely to implementing new features or fixing bugs so that the users will continually benefit from the use of the software. In this tutorial, we’ll see how we can get started in open source — starting from learning about Git and Version Control. That means that this piece is aimed at beginners, but experienced developers can learn a few things.

Version Control

Think of an artist drawing a child, as her pencil hits the canvas, the work takes shape, but only one piece of work will be available at the end. What if, as the artist paints, there’s a new version produced at each stage. After she has drawn the head of the child, she then saves that version by putting it up on some kind of system. She continues to draw; this creates a new version. She can opt to store this updated version separately, a different copy that is an extension of the previous version she saved, such that she now has two available versions, the newly updated version will also have what she has previously done. As she works on the drawing, a second artist comes and asks to help draw the right hand of the child. He pulls the second version and works on it, not making any direct changes to the current work the first artist is making. In the end, three artists in total contributed to the painting, and there are 20 versions available, this includes the completed version with the possibility of them going back to a previous version and doing something entirely new with it. This is similar to how version control works. It’s a system that makes it possible for developers to manage contribution to software as a team. In our example, if we make a special kind of canvas that generates and save the versions of pictures drawn, that system will be a kind of version control system geared to helping artists manage their contribution to making art. This version control system (which is also called VCS) should be able to show differences between versions of work created, and able to detect scenarios where there are going to be clashes (or conflict) between an old and new version. For example, if an artist works on the arm and other works on the hand, these two parts should be able to fit perfectly like they were drawn together. In cases where this does not happen, the difference should be detected, and the artists alerted about it. This version control system will manage the work manage by;

Storing versions of the same work or project, which is a collection of the changes (history) of the project (software). Make it possible for the team to be able to communicate the changes the made when working on their designated part It can also serve as a backup of the work that was done.

Git

Git is a modern version control system that is popularly used for the development of software. It gives you all the benefits you can get from using a version control system, alongside additional ones that make contributing to open source possible. By using git, all the developers working on a system will be able to have a copy of the software on their local machine. This is a result of git is a distributed version control system. If you do not have git installed on your machine already, you can follow the instructions below to do so.

Installing Git

To make use of git, you need to have it installed on your local machine. For the purpose of this tutorial, we’ll cover its installation on Linux (Ubuntu), Mac, and Windows. To be certain that you don’t have git installed already, run this command from your terminal. If you get an error that says the command cannot be found, you can then proceed to install it depending on the operating system you use.

Ubuntu

While in your terminal, run the commands below:

Mac

Let’s start with installing brew – a package manager that makes it easy to install and compile packages.

Windows

You can download the official Git version for Windows from here. The next step is to configure git with our details. While at it, we’ll also go ahead to step it up to work with our Github account, this is then the perfect time to talk about Github.

Github

Let’s go back to the imaginary version control system we wanted to build for artists. Remember how we said that git is a type of a version control system. While the version control system will help the artists in collaborating together, at some point, they’ll need some way to store the different works they have done. While each project will be managed by a version control system, it will be great if there’s a way to keep (store) the completed works. That’s where Github comes in. Think of it as a filing cabinet that will hold the different projects in something that we can attribute as cabinets. So the boy the artists were drawing will be stored in a cabinet, and managed by git. When they start another project, this will be stored in a different cabinet and also managed by git. Each of these projects will be independent of how git manages them. In software development, we do not call them cabinets; we call them repositories. Github is a cloud hosting service where these projects are stored. To create a GitHub account, you have to go to the sign-up page to create an account. We won’t be diving into the different aspects of GitHub in this piece, create the account and confirm your email address, then return here when you are done.

Configuring Git

To start making use of git, we need to configure it with our details. One of the benefits that come with using git is that aside from keeping track of the changes that were made across time, it also tracks who made the change. For this to happen, it needs to be configured with your details. To do that, you need to open your terminal. The first sets the UI color for git’s output to true, while the others set the name and email of the user, which is you. So you need to enter your name and email address inside the quotes. I suggest you make use of the username you used for creating your GitHub account. Next, let’s generate an SSH key. SSH keys are used for authentication, and it includes a pair of public and private keys. Where one key (the public key) is used to encrypt a message, and the other is used to decrypt the message. While you can also login to your GitHub account using your username and password, another way GitHub authenticates users is through the use of SSH keys. To generate one, you have to enter the command below: Remember to make use of your email address. You will be asked for a location to save the key; you can pick the default by hitting the enter key. You will also be asked for an optional passphrase to make the key secure, and you can skip that if you want. In the end, the key will be generated. Next, you will need to copy the generated key; you can get the key by running this command Copy it and click here, then click on the New SSH Key button, paste the key you copied, enter a title, and save it. For the title, you can opt for the machine you currently use. Example; MacBook Pro. To confirm it worked go to your terminal and enter this command, It should give a response like this. Hi kinsomicrote! You’ve successfully authenticated, but GitHub does not provide shell access.

Conclusion

Now you know what an open-source project is and how version control and git fit into the picture. Remember that git is a type of version control system, which is a system that makes it possible for developers to contribute code to a project, the project can then be hosted on a cloud hosting platform like GitHub. With this understanding, the next step will be to learn how to use git to manage your project.

Open Source 101  Version Control System and Git - 16Open Source 101  Version Control System and Git - 62Open Source 101  Version Control System and Git - 45Open Source 101  Version Control System and Git - 71Open Source 101  Version Control System and Git - 63Open Source 101  Version Control System and Git - 27Open Source 101  Version Control System and Git - 93Open Source 101  Version Control System and Git - 99Open Source 101  Version Control System and Git - 46