Git Source Control using CentOs7, GitHub and Vim

Sharon Johnson
5 min readFeb 5, 2023

--

What is source control?

To track and manage changes to files.

What is Centos 7?

CentOS is an upstream open source development platform which allows you to develop, test, and contribute to a continuously delivered distribution

What is Git?

Git is a distributed version control system that tracks changes in any set of computer files, its used to coordinate work collaboratively from other programmers to develop source code during software development.

What is GitHub?

GitHub is a open source control that let multiple people make separate changes to projects at the same time, it allows for real time collaborations. In a nutshell to work together to build and edit content.

What is VIM?

Vi Improved is a open source editor.

Okay since we have gotten all of the what is out of the way. I’m currently a student with Level Up In Tech and was giving a project, was tasked to edit and change codes from the team repo, the team will manually check the code before putting into production.

Objectives:

  • Fork the repo
  • Clone the fork repo
  • Using VIM to create a change to a file called linux.sh that is in the repo directory.
  • Save the file and add to my local repo and commit the file.
  • Push the file to my GitHub repo
  • Then send a pull request.

Task 1: Installing Git

Step 1: sudo yum install git (this will require your password)

Once it runs the package (see the bottom of the example below) you will be asked “Is this ok” (y).

This will continue to run until you see complete!

From here you will do the following commands:

git config -l

git config — — global user.name (your name)

git config — — global user.email (your email)

git config -l (this will list out your information that you provided)

Task 2: Now you are going to add in the VIM editor

sudo git config — — system core.editor vim

git config -l

Now we are going to cat ~/.git config (you will see name=your name and email=your email).

cat /etc/gitconfig (this will show you your editor=VIM)

Now you have completed the install of GIT and VIM

Task 3: Set up your GitHub account by logging in to github.com

Task 4: Fork a repository on GitHub

What is a repository or “repo”?

A software repository, or repo for short, is a storage location for software packages. Often a table of contents is also stored, along with metadata.

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.

Step 1: Now its time to fork the repo, click on the fork icon, open and create the repo your are working on.

Step 2: Cloning your repo

You will need to click on the green code button that will provide you with a https link with your information.

Step 3: Go back to your Centos 7 server and run command:

mkdir gitrepo

cd gitrepo/

git clone https://github.com/SharonLUIT/LevelUpTeam.git (using my example) you will need to add your know information for your repo.

cd LevelUpTeam/

ls -l

This will list the content for LevelUpTeam, find file Linux.sh, since this file is not executable you will need to do the following command

sudo chmod +x linux.sh

Now run command vim linux.sh to modified the repo, using I for Insert and use Esc to exit and :wq to save.

After closing use command ./linux.sh to see your modification on your repo.

Task 5: Lets Commit your repo

Step 1:

git add linux.sh

git status

Step 2: “Let’s commit”

git commit -m ‘your message’

Task 6: “Let’s Push”

Push the local repo to the main repo on GitHub.

git push -u origin main

*** If you receive an error message go into Git Hub and create a token***

Instructions on getting token:

Go to GitHub, click on setting, developer setting, personal tokes and create token, copy and paste as your password.

Task 7: Pull Request

Step 1: Go to the main repo in LevelUpTeam, click pull request, then new pull request, final step create pull request.

Final step make sure you branch has no conflicts

You have just installed GIT, GITHUB and completed a forked repo, clone, make changes in Vim, commit, push and pull your repo.

--

--

No responses yet