Using Git for Source Control and Programming

1 hour
  • 3 Learning Objectives

About this Hands-on Lab

This hands-on lab allows you to practice using the Git source control system. As one of the objectives for the Linux Foundation Certified Engineer, you may be asked to set up, configure, and perform basic tasks on a local Git instance. Once this activity is complete, you will understand how to install, configure, and check files into and out of the Git server using the command line.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Install the `git` Tool

Install Git using the following command:

sudo yum install git -y
Initialize a `webapi` Repository
  1. Initialize a new webapi Git repository in the /home/cloud_user directory:

    git init ~/webapi
  2. Create the following files in the webapi directory:

    • README, which should only contain the text: webapi
    • currver.txt, which should only contain the text: v0.1
  3. Add the files to the repo:

    git add *
  4. Commit the files with a comment:

    git commit -m "First commit"
  5. You will then be prompted to configure some variables. Follow the prompts to complete the commit.

Clone the ‘webapi’ Repository After Configuration into a Backup Directory

Create a backup directory in the /home/cloud_user directory that contains a clone of the original webapi repo you previously set up:

git clone /home/cloud_user/webapi /home/cloud_user/backup/webapi

Additional Resources

Your team is going to begin development of a new web-based API. As the supporting system engineer, you have been provided credentials to a new shared development server they will be using. You have been asked to install a local Git server instance they can use to track their code changes.

Once you have Git installed, create a new repository called webapi in the home directory of the user you are signed in as.

After that is complete, add the appropriate configuration variables to the Git configuration so files can be added and committed, and the cloud_user account can clone that repository locally if desired in another location.

Create a README with the text webapi inside it and another file called currver.txt with the text v0.1 inside it. Add and check in those files, and verify the repository is up to date.

Finally, clone the repo in the directory /home/cloud_user/backup/webapi and verify the test files you created are there. Once complete, you can turn the server over for your team's use.


To get started, log in to the lab server using the credentials provided:

ssh cloud_user@<PUBLIC_IP_ADDRESS>

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!