Git & GitHub // A Collaboration

A Beginner’s Guide to Git & GitHub

Melissa (Mel) Foster
Women in Technology
5 min readMar 6, 2023

--

Image Github logo.

If you have found this article, you might be just starting out exploring the benefits of Git & Github. I am glad you’re here! Today, I will be walking through basic commands and configuration to get you ready to collaborate on your next project with your team.

A little background //

Git is a free open source distribution version control system for source code management. Git allows teams to coordinate and collaborate together by tracking changes made to the file.

GitHub is a for-profit software company that offers a cloud based code hosting platform for version control and collaboration; creating the ability for teams to work together on projects from anywhere. You can find more information on how to get started:

To follow along with this project you will need //

  • GitHub Account
  • Access to a Cloud Server (I will be using an ACG Server)

Our Objectives //

  • Fork the Level Up In Tech’s Team Repo
  • Clone the forked repo to our ACG cloud server environment.
  • Edit linux.sh
  • Save the file
  • Add updated file to our local repo
  • Commit the file
  • Push the file back to our own GitHub repo.
  • Send a pull request to merge with Level Up In Tech production repo

To begin we will head to github.com to locate the Level Up in Tech Repo to create a Fork.

Fork/Forking- Creates a copy of the original repository. This gives you the ability to freely experiment with changes without affecting the original repository.

  • Use the Search Bar to enter name of Repo or Person LevelUpInTech
  • Select Repo LevelUpTeam
  • Select the drop down arrow by Fork
  • Create New Fork
  • Add Description
Note: Add Descriptions that will keep you organized to prevent errors

After creating our fork, we will start the cloning process.

  • Select Code

A window will open displaying options to clone from. We will be using the HTTPS address to clone the repo in an upcoming step.

Copy this http address as you will need it in a couple steps.

Switch to your Terminal or PowerShell to ssh and set up our cloud server to be ready for our collaboration. Log onto your server of choice, today I will be using CentOS 7.

Install Git //

We need to first install git onto our server by using command:

sudo yum install git
Remember to install you usually have to have permission to do so. Using sudo command gives you a higher access.
Success! You now have Git installed onto your server!

Configure //
We need to form a connection to our GitHub account to do so, we need to complete a configuration.

To configure Git with our user name & user email from GitHub by using the commands:

git config --global user.name [enter username from github]
git config --global user.email [enter email you used with github]
Remember that Spelling and Case Sensitivity is EVERYTHING! I had a small error due to misspelling. Correctly enter and your user name and email will be listed.

Create New Directory & Clone Repo//
We will need to create a new directory to clone the repository into.

mkdir [ENTER NAME OF DIRECTORY]

Once your new directory is created change into that directory with the command cd followed by the name you chose:

cd GreenTeamRepoProject

Inside our directory we will now clone the repo by copying the https address we located earlier, and using the git clone command:

git clone [PASTE HTTPS ADDRESS]

Wow! Great job so far! Let’s keep going! Using the ls command to list, we can see that our LevelUpTeam Repo is now showing as a directory.

We can cd (Change Location)to inside the directory, and once again use the ls command to view scripts and files.

Edit & Save //

Our objective today, is to edit the linux.sh script. To do this we are going to use our VIM editor. Run the code vim followed by the file/script to edit.

vim linux.sh

Once inside you can edit what you feel is necessary. I chose to edited so my name and user name would populate. I changed the date to today’s date, and I notice that line 17 looked off to me so I added the && curl if config. me to that location. Once you feel comfortable with your changes save and exit using :wq

Tip: to make things easier to read, I like to use the command :set number which will now show the lines of the script.

To view changes outside of vim, use the cat command:

cat linux.sh

Stage, Commit & Push//

So, far I am feeling pretty good, how about you? Let’s stage our changes using a few more git commands. (Staging allows us to set things up to push back to the repo for approval of changes.)

git add linux.sh
git status

git commit -a -m "mel foster made changes to this file"
Note: when leaving a commit comment your company may require you to add your name, and a brief description

I am feeling confident, and I am now going push it to GitHub

git push -u origin main

You will be prompted to enter in your username from GitHub, and you will be prompted to enter your password. This is not the password you log into GitHub. You will need an Access Token that will operate as your password. To create a Access Token you can review this article, where I break down the steps.

Looks like a successful Push.

Let’s check back on GitHub under our Pull Requests, then New pull request

As you can see, I made several attempts to change the file. I lost connection unfortunately and wanted to ensure that I did submit a completed edited file.

Screenshot by author.

If you scroll down you can compare changes.

Screenshot byo author.

Congrats, you made it to the point where the team can approve or deny changes. Thanks for sticking around, I hope you were successful and will join me for another project soon!

Join me on https://www.linkedin.com/in/melissafoster08/ or follow me at https://github.com/mel-foster

--

--

Melissa (Mel) Foster
Women in Technology

𝔻𝕖𝕧𝕆𝕡𝕤 𝗘𝗻𝗴𝗶𝗻𝗲𝗲𝗿 |𝒲𝑜𝓂𝑒𝓃 𝐼𝓃 𝒯𝑒𝒸𝒽 𝒜𝒹𝓋𝑜𝒸𝒶𝓉𝑒 | 𝚂𝚘𝚌𝚒𝚊𝚕 𝙼𝚎𝚍𝚒𝚊 𝙲𝚛𝚎𝚊𝚝𝚘𝚛 | Photographer