Abidoye Joshua mayowa
7 min readFeb 6, 2023

Forking, Cloning, Vim Editor, pushing and Pulling a repository.


Hello, guys thanks for checking up on my page today. In this post, we will go through the following process fork a repository, edit it with Vim, and push and pull a request to merge it to an open-source collaboration project. let's start the project.


  • A personal computer.
  • Command Line Interface
    Windows: PowerShell
    Mac: Terminal.
  • Virtual CentOS 8 cloud server.
  • Reliable high-speed internet.
  • A GitHub account.
  • sudo privileges on the system as a non-root user.

Case study

You are tasked with editing and changing code from your Level Up In tech team repository. After making changes, the team would like to manually check the code before putting it into production.

Objectives of the Case study

  1. Fork the Level Up In Tech Repo
  2. Clone the forked repository to your ACG cloud server environment
  3. Using Vim, create a change to the Linux.sh file that is in the repository directory
  4. Save the file and add it to your local repository, then commit the file
  5. Push the file back to your own GitHub repository
  6. Send a pull request to merge with Level Up In Tech production reposit

What is GitHub?GitHub is a code hosting platform for collaboration and version control. GitHub lets you (and others) work together on projects.

What is Vim? Vim is a handy and helpful editor for creating and editing different types of files more efficiently. This editor adds many new features, making it a powerful editor. Many coders develop many plugins for this editor to increase and configure its core functionalities.

Now we know what Github and vim editor is, let's move to the next step.

Step 1: Create a Github Account

The first thing to do is to create a GitHub account, If you already have one, move on to Step 2.

Step 2: Install and configure Git

We need to open up our cloud server and SSH into it! Once we are logged in we need to install Git.

sudo yum install git

You need to use sudo as the prefix to elevate privileges and install Git. If we follow the above step we should get the image below.

Once it is installed, we have to configure Git by adding our username and email. Ensure you enter your username and email address, not the one below. The one below is to show an example.

git config --global user.name YourUserName
git config -- global user.email YourEmail@gmail.com

Step 3: Forking

A fork is a new repository that shares code and visibility settings with the original “upstream’’ repository. Forks are often used to iterate on ideas or changes before they are proposed back to the upstream repository, such as in open source projects or when a user does not have write access to the upstream repository.

The next step is to log into GitHub and locate the repository you want to copy. Below is the repository I want to make edits to. Once you locate the repository you want, click the Fork option.

Click on Fork, located on the top right side of the screen.

Afterwards, you should ensure you add the required information. Congrats on forking your first repo.

Step 4: Cloning the forked repository

Now you have made a copy of the repository. Next up is cloning it to have access to it locally. When you clone a repository, you copy the repository from Github.com to your local machine.Cloning a repository pulls down a full copy of all the repository data that Github.com has, including all versions of every file and folder for it.

To clone the repository, you need to copy the HTTPS URL code. Click on the green Code button on the right and select the HTTPS option. Copy that URL code.

Now we will open up the Command-Line of your choice. I am going to use Windows PowerShell. Paste the command below into your command line of choice.

Note: Use your Github username in place of 'YourUserName'. It should be precisely how you copied it.

git clone https://github.com/YourUserName/LevelUpTeam.git

You have just created a copy of the repository onto your server, Let's check our work to ensure all runs smoothly. All associated files and directories should pop up for you now. ll is an alias for ls -l on most systems.

ls -l

Step 5: Using Vim to make changes to the repository

We are almost there! We need to be in the correct working directory to make any changes. Remember that everything is case-sensitive within the command line, so pay close attention.

cd LevelUpTeam

Let's confirm that we have the linux.sh file in our new directory, we will use the command below to confirm.

ls -l

Since the file we need is in the current working directory, The linux.sh file is an executable file, but we don't have the required permissions to execute the file.Using sudo, we can make changes to the permissions to avoid issues later on. Let's use the command below to change the owner's permission to executable.

sudo chmod 764 linux.sh

The above command will make the file executable, So let's use the command below to see if the permissions were changed.

ls -l

Excellent! We were able to make the file executable! Now let's open up Vim and edit the file we want. Use the command below to open the file. One quick reminder when using Vim, to get into insert mode, press I for insert mode and ESC for command mode.

Vim filename

I edited the file with my information, and now I want to save it and run the script. Recall that to save and exit Vim; you must be in command mode and then press :wq!. If you want to exit the file without saving it, then press:q!

let's run the script linux.sh. Congrats, it worked. Let's keep moving.

Step 6: Adding the edited file to local repository and committing the file.

Now that we have made the changes we wanted, we have to add the file onto Git to keep track of the changes. We need to ensure the file was added, Use the commands below to do this.

git add linux.sh
git status

If your side of things looks similar, then good job! We are almost done! Now we must commit the file. To commit the file, Use the command below.

git commit -m "Message about the edit you made" 

If it worked you see the image attached below after running the command.

Step 7: Push it to GitHub

To push the edits to the GitHub repository, use the command below.

git push -u origin main

Oops, we encounter an error, So it looks like we need a Personal Access Token instead of the username and password for GitHub authentication.

To access the Token, Once in your GitHub account, go to Settings, Developer Settings, Generate new token, Enter a token name, Select an expiration date, Add a description, Make selections on which repositories you want the token to access, Select your permissions, and Generate token!

Now, let's try to push it again and use the Personal Access Token this time.

Excellent!, Let's go ahead and log back into Github and refresh to see if our file was pushed.

Step 8: Send a Pull request to merge your edits with the original repository

On the same page in Github, Click on Pull Requests and select New Pull Request on the right. Check the image below for confirmation.

Now you can submit the Pull Request! It should look similar to the image below.

At last, we have completed the project, Thanks for following along. I will post more projects as I continue my journey to become a DevOps Engineer.


Abidoye Joshua mayowa

DevOps Engineer. I'm interested in collaborating with anyone interested in cloud engineer or cloud DevOPs.