Introduction
My first week studying Data Science and Analytics involved an initiation to Git. Before then, I had only encountered GitHub as a place where developers stored code, but I had not really understood what was actually happening.
In this article, I take you on the journey of my first experience with Git, taking a project from a folder on my pc, and pushing it to a GitHub repository using Git and SSH. We will cover installation and configuration, how Git works, the creation and authentication of an SSH key, creation of a GitHub repository, and finally, pushing a project to GitHub.
Git, GitHub and SSH
Git
Git is a version control system. This means that it helps you keep track of your ongoing projects in a variety of ways. You can save versions of your project, retrieve older versions, create separate branches of your work, and even merge different people's work together. It's saved in your pc so you can also work offline.
GitHub
GitHub is a platform that lets you store and collaborate on Git projects online. As Git manages the version history of a project, GitHub provides an online location where that repository can be stored and shared.
SSH Keys
The word SSH in full stands for secure shell. This is a protocol that is used to establish secure communication between computers over a network. Instead of having to enter your username and password constantly, the key provides a secure method of authenticating your computer with GitHub.
The key itself is comprised of a pair that is the private and public key. The private key is private, as the name suggests, stays on your pc and should never be shared with anyone. The public corresponding key is what goes in your GitHub account.
Installation
The first step was to create a GitHub account and install Git Bash on my computer. Git Bash is a command-line environment on Windows which executes Git commands. This was my first introduction to the fact that development tasks can be performed directly through a terminal.
Configuring Git
The next step was configuration. Git needs to know who is using it, so I configured my username and email address using;
git config --global user.name "Wairimu Becky"
git config --global user.email "beckywairimu@gmail.com"
I checked whether the configuration was successful using:
git config --list
I also configured the default branch name to "main";
git config --global init.defaultBranch main
A branch is a line of development inside a repository.
Generating an SSH Key
I generated the key using:

The terminal then prompted me to choose where to save the key and whether to create a passphrase. The file ending in .pub is the public key, while the corresponding file without .pub is the private key.
After generating, I copied the public key to my GitHub account, under the SSH and GPG key section.
Authentication
After adding the public key and verifying using email, the next step was to test whether the SSH connection was successful using;

How Git works
There are some different processes involved when using Git;
Working directory
This is the project folder where I create and edit files. When I make a change, Git detects that the file has been changed, but the change has not yet been prepared for a commit.
After making sure I was in the right folder using;
cd Desktop,
I began by creating these folders using;
mkdir my-first-GitHub-project
mkdir data
mkdir notebooks
mkdir scripts
touch README.md
touch analysis.py
Then, I input some text into the readme file using;
nano README.md
Staging
This is the process of selecting the changes I want to include in the next commit using:
git add . (The dot represents the current directory)
You can check which files have not yet been tracked, or have been modified, or staged using:
git status
Commits
A commit is a record of a checkpoint in the project's history. It should clearly describe what has been added/changed.
Once the files I have chosen are staged, they can be recorded in a commit:
git commit -m "Add Analysis Project"
Now the project is a Git repository on my computer. We've still not yet uploaded to GitHub.
GitHub Repository
The purpose of this repository is to become the remote location connected to my existing local repository. Next, is to tell Git the location of the remote repository. Once I created a GitHub repository, I used the link provided under SSH connection in Git;
git remote add origin (paste the link here)
The connection can be checked using;
git remote -v
Push
Now, it's time to push the project existing locally to GitHub using;
git push -u origin main
After running the command successfully, I refreshed the GitHub repository page and saw the project files that I had created on my pc.
In Conclusion
What I learned from this process, is that Git is what tracks and manages the history of a project, while GitHub is the online platform for hosting and collaborating on that project. SSH provides secure authentication between my pc and GitHub.
As someone beginning a journey in Data Science and Analytics, learning Git is clearly a very useful technical skill. While my first GitHub push may have been a relatively small achievement, it introduced me to a space that will evolve far beyond this first project.













