DEFINATION OF TERMS - GIT
GIT - This is a free and opensource distribute version controll system. It runs locally on a developers machine but may also be hosted centrally or remotely in a specified server within an organization to aid in version control.
its never a good idea to explain terms with more jargon. While reading the explanation above, I have realized that I did not mention what a version control system is.
Version Control - In technology, this is the practice of keeping track of a software system's many versions and configurations over time.
This task is normally carried with the aid of a version controll system.
AN EXAMPLE
The best way to explain how git works is with a simple python example.
On my first day in a data engineering class we created a small python file and named hello world. inside the file was this line of code.
print(" Hello World")
Towards the end of the lesson we chnaged the line of code to
'print(" Hello World, My name is AMOS and I am a data engineer.")
The lecturer gave us an assignement to modify the print statement above and make it print in two lines. After completeing this I had the following line of code.
Print(" Hello World! \n My name is AMOS and I am a data engineer.")
After this exercise, I realized I needed to keep track of my small hello world project how it started and how it had evolved. I ended up creating 3 folders;
- hello_world_1
- hello_world_2
- hello world_3
In each of the folders, I saved a file named hello_world.py with the sample lines of code written above.
This seemed like a great idea at the time, after all if all you have is a hammer, everything looks like a nail.
What I had created here was a version control system of sorts, this alowed me to keep track track of chnages made to my python project. There are many problems with this approach;
- The entire project is hosted on one machine (my laptop).
- Single point of failure (losing the laptop means losing all the code).
- Collaboration with other developers is very challenging (share files as email attachments).
- Its hectic to manage especially with big projects.
HELLO WORLD IN GIT
GIT solves all these problems and provides us with many more features. To experience the power of GIT we have to download and install this software in our computer.
Installing git.
- Visit the git-scm site and download the latest release for your operating system. I am on windows and so I got version
Git-2.52.0-64-bit.
- Double click on the downloaded file to open it. Being an executable, opening the file will run the installer for GIT.
- Your computer will ask you if you really want to allow the file that you have just openned to make chnages to your computer. click allow to agree.
- Read the GNU License agreement and click next if you agree to comply with the terms.
- On the next screen, the installer will ask you to select a folder in which to install GIT. leave it as default and click next.
- On the next screen, the installer will ask you to select the git components that you wish to install. leave it as default and click next.
- On this screen, the installer will ask where it should place GIT's shortcut, leave it as default and click next.
- On the next screen, the installer asks which code editor you would like to use for GIT, choose an appropriate one depending on your preference, I chose VS Code as depicted below and click next.
- On the next screen, the installer asks how you would like to name your initial branch in git repositories, leave it as default and click next.
- On the next screen, the installer asks how you would like to use Git from the command line. Leave it as default and click next.
- On the next screen, the installer will ask you which secure shell client you would like to use. Choose
Use bundled OpenSSHand click next.
- On the next screen, the installer will ask you which SSL you would like to use, leave it as default and click next.
- On the next screen, the installer will ask you to choose a line ending conversions. For reasons will not get into here ensure you select
checkout Windows-style, commit Unix-styleand click next.
- On the next screen, the installer will ask which terminal emulator you would like to use,leave it as default and click next.
- On the next screen, the installer will ask you to choose the default behaviour of
git pullchooserebaseand click next.
- On the next screen, the installer will ask you to choose your credential manager of choice. leave it as default and click next.
- On the next screen, the installer will ask you to choose which features you would like to enable, leave it as default and click on the install button.
- The installer will run for about 30 seconds or more depending on the speed of your computer.
- The installer will show you the screen below. uncheck view release notes, and click finish.
Now that we have GIT installed we need to setup a few things;
- A username.
Open git bash on your computer, on the prompt type the following command replacing myName with your actual name.
git config --global user.name "myName"and press enter. - An Email.
On git bash type the folowing command replacing myemail@domain.com with your actual email address.
git config --global user.email "myemail@domain.com"
With that done, we need to create a repository.
CREATING A REPO
Think of a repository as a project, a container that contains all the code we have written so far upto this point and any other code that will ever write.
- Open the hello world project. Right click on the file explorer and choose open git bash here.
- Type the command
git initon git bash. You will get a message, initialized an empty Git repository ......... Create a new file named hello_world.pytouch hello_world.pythis file will not be within any of the folders we had created earlier. Edit the new file by typing nanohello_world.py, this will open up a simple text editor, write your code print('Hello World') here and click ctrl + O folowed by enter to save it. Click ctrl + x to exit the edit. - Stage the new file by typing the command
git add hello_world.py. - Commit the file by typing the command
git commit -m 'initial commit'. - Make changes to the same file by folowing the steps 2 , 3 and 4 above updating the contents of the file to
'print(" Hello World, My name is AMOS and I am a data engineer.")the commit comand togit commit -m 'added my name'. - Follow step 5 above updating the contents of the file to
Print(" Hello World! \n My name is AMOS and I am a data engineer.")and the commit command togit commit -m 'added new line'. - Type
git log --onelineto see the history of the project.
DEFINATION OF TERMS - GITHUB
This is a web based cloud platform where developers and artists come together to create software. As the name implies, it hosts a tonne of git projects but also provides other features such as CI-CD rule based collaboration, 2 factor authentication etc.
Creating a Github Account
head over to https://github.com/ and create an account.
On your localmachine;
- Ensure SSH is running
$ eval "$(ssh-agent -s)". - Generate an SSH Key pair
ssh-keygen -t rsa -b 4096 -C "myemail@domain.com". - Add a passphrase for securing the SSH key pair.
- Add the SSH ID to the local SSH key manager.
ssh-add /c/Users/user/.ssh/id_rsa. - Sometimes this step will return an error, repeat step 1 above.
- Copy the public key on windows
clip < /Users/user/.ssh/id_rsa.pubOn Linux open the file via Nano and copy from there. - Add the new key to the GitHub account and test the connection by executing
$ ssh -T git@github.comon git bash. - Git will ask for your passphrase and then return a message as shown below;
user@machine MINGW64 ~/Documents/Hello_world (master)
$ ssh -T git@github.com
Enter passphrase for key '/c/Users/amoh/.ssh/id_rsa':
Hi [github_user_name]! You've successfully authenticated, but GitHub does not provide shell access.
Next article:
** Pushing your Local project to Github.**
Keep on keeping on.
Signed kiarieamos

Top comments (0)