0% found this document useful (0 votes)
20 views6 pages

Lab Activity - Exercise 12 - Create and Connect A GitHub Repository

This document outlines a lab activity for creating and connecting a public GitHub repository for a CAP project. It includes tasks such as creating a GitHub repository, generating a personal access token, and initializing a local git repository to push project content. The activity requires prior setup of a CAP project and a GitHub user account.

Uploaded by

salimansari2011
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views6 pages

Lab Activity - Exercise 12 - Create and Connect A GitHub Repository

This document outlines a lab activity for creating and connecting a public GitHub repository for a CAP project. It includes tasks such as creating a GitHub repository, generating a personal access token, and initializing a local git repository to push project content. The activity requires prior setup of a CAP project and a GitHub user account.

Uploaded by

salimansari2011
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

LAB ACTIVITY SAP CAPM

SA

Exercise – Create and Connect a GitHub Repository


Business Scenario

In this exercise, you will create a public GitHub 1 repository for the source code of your
application.

Task Flow

In this exercise, you will perform the following tasks:

 Create a public GitHub repository to store the source code of a project.


 Create a personal access token for GitHub.
 Connect your GitHub repository with your CAP project.
 Initialize the local git repository.

Prerequisite

To create a GitHub repository, you need a CAP project and a GitHub user. If you do not have a
GitHub user, sign up for GitHub first.

Task 1: Create a Public GitHub Repository

1. Create a Public GitHub Repository to store the source code of a project.


a) Open and sign in to https://github.com/.
b) In the Repositories tab, choose New to create a new repository.

1 Copyright© 2024, ZaranTech LLC. All rights reserved


LAB ACTIVITY SAP CAPM
SA

c) As the Repository name, enter RiskManagement. Don't tick any of the Initialize this
repository with checkboxes.
d) Choose Create repository

2 Copyright© 2024, ZaranTech LLC. All rights reserved


LAB ACTIVITY SAP CAPM
SA

e) Copy the HTTPS URL of your newly created GitHub repository.

Task 2: Create a Personal Access Token for GitHub

1. Create a Personal Access Token for GitHub.

To create a personal access token, which you can use instead of a password, follow the steps
described in Creating a personal access token 2.

Task 3: Connect Your GitHub Repository With Your CAP Project

You have created a new, empty GitHub repository. To be able to use it as a repository for your
risk management application source code, you need to connect it with your CAP project. Until
now, the only place where your project's source code resided was your personal dev space in
SAP Business Application Studio.

1. Connect Your GitHub Repository with Your CAP Project.


a) Return to your SAP Business Application Studio.
b) Open a new terminal and navigate to your project root folder.

3 Copyright© 2024, ZaranTech LLC. All rights reserved


LAB ACTIVITY SAP CAPM
SA

c) Enter your email address and username. You can use the email address that you've used to
register your GitHub account

git config --global user.email [email protected]

git config --global user.name "Your Name"

This configures the git command line tool locally in your Business Application Studio dev space.
Now when you do file changes and commit them to a git history, git will use the configured
name and email in these commits.

4 Copyright© 2024, ZaranTech LLC. All rights reserved


LAB ACTIVITY SAP CAPM
SA

Task 4: Initialize the Local git Repository

Since we cloned the starter template from GitHub, we already have a GitHub repository.
Therefore, we do not have to create a new local one. All we have to do is to commit all our
recent changes, link the new GitHub repository with our local one and to push the changes to
GitHub.

1. Initialize the local git repository.


a) Add all directories and files to the git staging area. Perform the command:

Perform the command:git add.

b) Create the first commit in your git repository.

Perform the command:git commit -m "Push project content to GitHub"

c) Add your copied GitHub repository URL from the previous part of the exercise as remote
repository (without the angle brackets '<' and '>' ):

Perform the command:git remote set-url origin <copied Git repository url.git>

This tells your local git repository in the Business Application Studio dev space, that it has a
remote counterpart on GitHub. The remote counterpart should act as the origin, thus it is the
repository that you and your colleagues use as the central repository of your project.

d) Push the commit with your project content to this GitHub repository:

Perform the command:git push -u origin main

This tells your local git to push the main branch to the remote repository. The -u option is used
because the branch main did not yet exist on the remote repository.

5 Copyright© 2024, ZaranTech LLC. All rights reserved


LAB ACTIVITY SAP CAPM
SA

e) When prompted, enter your GitHub username and the personal access token, that you have
created previously

You have connected your CAP project with your public GitHub repository using git commands

6 Copyright© 2024, ZaranTech LLC. All rights reserved

You might also like