Introduction
Open source projects hosted in public repositories benefit from contributions from the wider developer community and are typically managed through Git.
A distributed version control system, Git helps individuals and teams contribute to and maintain open source software projects. Free to download and use, Git is an example of an open source project.
This tutorial discusses the benefits of contributing to open source projects and goes over installing and setting up Git so you can contribute to software projects.
Participation in open source projects
Open source software is software that is freely available for use, redistribution, and modification.
Projects that follow the open source development model encourage a transparent process that progresses through distributed peer review. Open source projects can be updated quickly and as needed, providing reliable and flexible software that is not built on locked-down proprietary systems.
Participating in open source projects helps ensure that they are as good as they can be and represent the broad base of end users of the technology. When end users contribute to open source projects through code or documentation, their diverse perspectives provide added value to the project, the project's end users, and the larger developer community.
The best way to start contributing to open source projects is to start by contributing to the software you already use. As a user of a particular tool, you have the best understanding of what features are most valuable to the project. Make sure you read the documentation for the software first. In fact, many open source projects have a CONTRIBUTING.md file in the root directory that you should read carefully before contributing. You may also want to check out the community forums for the project, if available.
Finally, if you're starting out by contributing to open source software, it's a good idea to start small – every contribution is valuable. You might want to start by fixing typos, adding comments, or writing clearer documentation.
Git
One of the most popular version control systems for software is Git. Git was created in 2005 by Linus Torvalds, the creator of the Linux kernel. Junio Hamano, who was originally used to develop the Linux kernel, is the current maintainer of the project.
Many projects store their files in a Git repository, and sites like GitHub, GitLab, and Bitbucket have made it easier to share and contribute code. Each working directory in Git is a complete repository with a complete history and tracking independent of network access or a central server.
Version control has become an essential tool in modern software development because these systems allow you to track software at the source level. You and other members of a development team can track changes, revert to previous steps, and branch from the code base to create alternate versions of files and directories.
Git is very useful for open source projects because it facilitates contributions from many developers. Each contributor can branch from the master or main branch of the code base repository to separate their changes, and can then submit a pull request to merge these changes into the main project.
To use Git to contribute to open source projects, let's check if Git is installed, and if not, let's check how to install it on your local machine.
Check if Git is installed.
First, you need to check if you have the Git command line tools installed on your computer. If you have built your own code repositories, you probably have Git installed on your local machine. Some operating systems also come with Git installed, so it's worth checking before installing.
You can check if Git is installed and what version you are using by opening a terminal window on Linux or Mac or a command prompt window on Windows and typing the following command:
git --versionBut if Git is not installed, you will get an error similar to the following:
-bash: git: command not found
'git' is not recognized as an internal or external command, operable program, or batch file.
In that case, you need to install Git on your machine. Let's take a look at installing it on several major operating systems.
Installing Git on Linux
By far the easiest way to install and set up Git is to use the default Linux repositories. Let's take a look at how to install Git on your local Linux machine using this method.
Installing Git on Ubuntu or Debian
You can use the APT package management tools to update your local package list. After that, you can download and install the application:
sudo apt update
sudo apt install gitWhile this is the fastest way to install Git, it may be an older version than the latest. If you need the latest version, use this guide to compile Git from source.
From here you can go to the Gate settings section.
Installing Git on CentOS
We will use yum, the native CentOS package manager, to search for and install the latest Git package available in the CentOS repositories.
Let's first make sure that yum is up to date by running this command:
sudo yum -y updateThe -y flag is used to alert the system that we are aware of making changes and prevents the terminal from prompting us for confirmation.
Now, we can go ahead and install Git:
sudo yum install gitWhile this is the fastest way to install Git, it may be an older version than the latest. If you need the latest version, compile Git from source by following option 2 of this guide.
From here you can go to the Gate settings section.
Installing Git on Fedora
Git packages for Fedora are available via yum and dnf. DNF or Dandified Yum, introduced in Fedora 18, has been the default package manager for Fedora since Fedora 22.
From your terminal window, update dnf and install Git:
sudo dnf update
sudo dnf install gitIf you have an older version of Fedora, you can use the yum command instead. Let's update yum first, then install Git:
sudo yum update
sudo yum install gitFrom here you can go to the Gate settings section.
Installing Git on macOS
On your local Mac, if you type the Git command in your terminal window (like git --version above), you will be prompted to install Git if it is not already on your system. When you receive this prompt, you must agree to install Git and follow the instructions and respond to the prompts in your terminal window.
You can install the latest version of Git on your Mac by installing it via the binary installer. There is an OS X Git installer that can be downloaded from the Git website. Clicking here will start the download automatically.
Once Git is fully installed, you can go to the Git settings section.
Installing Git on Windows
For Windows, the official build is available for download from the Git website. Clicking here will start the download automatically.
There is also an open source project called Git for Windows, separate from the official Git website. It provides both command line and GUI tools for using Git effectively on your Windows machine. For more information about this project and to view and download the code, visit the Git for Windows project site.
Once Git is fully installed, you can go to the Git settings section.
Setting up Git
Now that you have Git installed, you need to do a few things so that the commit messages it generates for you contain your correct information.
The easiest way to do this is through the git config command. Specifically, we need to provide our name and email address because Git embeds this information in every commit we make. We can go ahead and add this information by typing:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"We can review all the configuration items that have been set by typing:
git config --listuser.name=Your Name
[email protected]As you can see, this format is a little different. The information is stored in your Git configuration file, which you can optionally edit with a text editor, such as nano:
nano ~/.gitconfig[user]
name = Your Name
email = [email protected]When you are finished editing your file, you can exit nano by typing the control and x keys and pressing y when prompted to save the file.
There are many options you can set, but these two are essential to avoid future warnings.
Result
With Git installed and set up on your local machine, you are now ready to use Git to version control your software projects as well as contribute to open source projects that are free to the public.
Adding your own contributions to open source software is a great way to further engage with the wider developer community and helps ensure that the software built for the public is of high quality and fully representative of end users.









