Source Control with Git using GitHub, Vim editor in CentOS 7

Stephanie Johnson
4 min readFeb 5, 2023

--

What is Git?

Git is a tool used for source control management in software development. It is a open source version control system capable of handling small to large projects efficiently. It allows multiple developers to work together, collaborate and develop source control during software development. It’s also free.

What is GitHub?

GitHub is a web-based interface that uses Git, its an open source version control software that lets multiple people collaborate and make change to a project for anywhere and at the same time.

What is Vim editor?

Vim is a free and open-source, screen-based text editor program

Objective for this project is:

  1. Fork the Level Up In Tech Repo Here: https://github.com/LevelUpInTech/LevelUpTeam
  2. Clone the forked repo to your ACG cloud server environment
  3. Using Vim, create a change to the linux.sh file that is in the repo directory
  4. Save the file and add to your local repo, then commit the file
  5. Push the file back to your own github repo
  6. Send a pull request to merge with Level Up In Tech production repo

Let’s get started

Task #1

Install Git using CentOS7

Open terminal and shh using your credentials

  1. $ sudo yum install git
  2. Now enter your sudo password

3. git config -l

4. git config — — global user.name “Your name”

5. git config — — global user.email “Your email address”

6. git config -l

Completed!

Check your output user.name and user.email

Task #2

Now let’s install Vim

  1. $sudo git config —system core.editor vim

enter your sudo password

2. git config -l

3. cat ~/.gitconfig

You have just install Git and Vim onto your CentOS7 server

Task #3

Setting up your profile to GitHub

  1. Log into github.com
  2. Set up your profile

Task #4

What is fork? A fork is a copy of a repository that you manage. Forks let you make changes to a project without affecting the original repository. You can fetch updates from or submit changes to the original repository with pull requests.

  1. Fork you repo, click into “fork” icon

2. Open and create fork repo that you are currently working with

3. Clone your repository to your server environment, click onto the green <>Code icon

4. Open your CentOS7 server

5. Use command mkdir gitrepo

6. cd gitrepo/

7. git clone https://github.com/StephanieLUIT/LevelUpTeam.git

(my example)

8. cd LevelUpTeam/

9. ls -l

10. You will see the file linux.sh

11. Since the file isn’t executable you will need to do the following run

sudo chmod +x linux.sh

12. Now you can open vim using command below to make modification to your current repo.

vim linux.sh

Make your changes by using i (INSERT) and when you are ready to save ESC and :wq

13. using command ./linux.sh to see your modified repo

Task #5

Time to commit your modified repo

Now let add this to our local repo

  1. git add linux.sh

2. git status

Now let’s commit your repo

git commit -m “What ever message you would like to leave”

Task #6

Now this push repo back to the local repo

  1. git push -u origin main
error: The requested URL returned error: 403 Forbidden while accessing

Go to Github click onto your Profile> Developer settings > personal tokens and create a token to copy and paste as your password.

Task #7

Now let’s do a “Pull Request”

  1. Go to GitHub and find your repo and select the “Pull Request”

2. Select “New Pull Request”

3. Then create your pull request

You have just completed the task of Forking, Cloning Pulling and Committing a Repository using Git, GitHub and Vim Editor.

--

--