Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
draysams
Advisor
Advisor
In this tutorial, I will try to walk you through the process of setting up a connection between your Corporate Github and the SAP Business Application Studio.

 

Prerequisite setup

  1. You should have a dev space in SAP Business Application studio. Follow this link if you don't have that setup already.

  2. You should have a corporate or enterprise github account and a project to clone.

  3. You should have SAP Cloud Connector installed on your local machine and be able to access it through your browser.


 

Process blueprint

  1. Generate personal access token from the corporate github.

  2. Connect SAP Cloud Platform to the cloud connector by adding a subaccount.

  3. Create a mapping to the corporate github from the cloud connector.

  4. Create a destination in SAP Cloud Platform to connect to the cloud connector.

  5. Create the .netrc file and fill it with the right credentials.

  6. Configure git with your email and user name.

  7. Clone your first project into SAP Business Application Studio.


 

Step 1 : Generate personal access token from the corporate github.

The personal access token will essentially serve as your password and it will have specific authorizations (scopes) associated with it to prevent abuse of the token. Let's now jump into our corporate/enterprise github account and generate the personal access token.

Visit your page in your corporate github and click your user avatar in the top right corner. Choose settings in the context menu that pops up.



Image 1: Select settings from the context menu


 

On the settings page, select personal access token and then click the Generate New Token button.


Image 2: Click generate new token


 

In the note text box, provide a descriptive name for the new token you’re generating. Choose the scopes that should apply to the personal access token you’re generating. I have to reiterate that it’s essential to select the bare minimum scopes needed to perform the tasks you’re generating the token for. You should try and stay away from the admin scopes, unless it’s absolutely necessary.


Image 3: Provide name and choose scopes


Click the Generate Token button at the bottom of the page.  


Image 4: Click generate token button


 

Click the copy button next to the generated token to copy it to the clipboard. Paste this code somewhere safe as this code will be required near the end of this tutorial.


Image 5: Copy the generated token and note it down


 

Step 2: Connect SAP Cloud Platform to the cloud connector.

Visit the hana trial cockpit, and click the “Enter your trial account button”


Image 6: Click the enter your trial account button


On the trial home page, take note of the region and the provider on the trial card and note it down somewhere safe. Click on the trial link at the top of the trial card.


Image 7: Note down your region and provider


On the trial subaccount page, note down the ID value under the subdomain as this will be used in setting up the cloud connector.


Image 8: Note down the ID value of your subaccount


 

For now, we’re done with the SAP Cloud Platform cockpit and we have to head on to the cloud connector. Login to your cloud connector.


Image 9: Login to your cloud connector


After logging in, we have to now link our instance of cloud connector to our sub account on SAP Cloud Platform.  Enter the details you have noted from the previous pages as you can see below and click the save button on the top right of the page.


Image 10: Define the subaccount with these details


If you entered the right details, your SAP Cloud Platform sub account will be linked the cloud connector and clicking on the name you defined, will show a page like you can see below.


Image 11: Cloud connector connected to SAP Cloud Platform


 

Step 3: Create a mapping to the corporate github from the cloud connector

Click on the Cloud To On-Premise list item on the cloud connector page and then click the plus (+) button under the access control tab.


Image 12: Click add mapping button


Follow the wizard and provide the details as you can see in the next image.


Image 13: Follow wizard with these details


 

If the right details were provided, the page should show something like below. You have to now click the plus (+) button on the Resources part of the page.


Image 14: Add resource path to the mapping


 

Now fill in the wizard that opens to look like the next image.


Image 15: Fill in the wizard with these details


If all the right details have been provided, when you click on the check connection button annotated in the image below, you should see that the mapping is reachable.


Image 16: Confirm that the mapping is reachable


 

Step 4: Create a destination in SAP Cloud Platform to connect to the cloud connector

We are going to start by assigning our user some roles to authorize it to make the connections to SAP Business Application Studio and Cloud Connector. Let’s visit the hana trial cockpit to start this step.

Click the users list item on the SAP Cloud Platform cockpit and then click your user.


Image 17: Select your user from the list of users


After clicking your user, on the far right section of the page, you should see the roles assigned to your user. Click the menu button next to the search bar and click assign role collection.


Image 18: Assign roles to your user


Assign the roles shown in the next image, essentially all the roles related to SAP Business Application Studio, Connectivity and Cloud connector.


Image 19: Assign remaining roles to your user


Now it’s time to create the destination to point to our cloud connector.

Click on the Destinations list item under connectivity and fill in with the following details to look like the image below before clicking the save button on the page.


Image 20: Create new destination and fill details


After your destination is saved, if you click on the check connection button, you will be presented with an error message. This is no cause for concern, it's a bug that will be fixed in one of the subsequent releases. Just close the error message and move on to the next step.


Image 21: Ignore this error message.


 

Step 5: Create the .netrc file and fill it with the right credentials

Navigate to your business application studio page and click on your dev space.


Image 22: Click on your trial dev space


Once you are inside SAP Business Application Studio, open the user folder by clicking the file menu item and and choosing open in the context menu.


Image 23: Open user folder in SAP Business Application Studio


Find the user folder in the dialog that pops and either double click the user folder or choose the open button at the bottom of the dialog.


Image 24: Choose user folder from dialog.


Now that we have the user folder open, we can now create the .netrc file. Right click on the user folder in the explorer panel of SAP Business Application Studio and choose New File.


Image 25: Choose New File


When the text box dialog pops up, type in .netrc and hit the enter key on the keyboard or click the OK button.


Image 26: Enter .netrc in textbox


 

Inside the .netrc file, follow the format below to fill the file and then save the file. This is where we need the personal access token we generated in step 1.
Sample .netrc file

machine github.wdf.sap.corp
login C48374833
password sdfn3uih-dsf3id-gnlasdnf3


Image 27: Enter the credentials in .netrc file


 

Step 6: Configure git with your email and user name

Now that we are done with the .netrc file, we have to configure git with our corporate git username and email. On the menu bar of SAP Business Application Studio, click on Terminal and choose New Terminal.


Image 28: Open a new terminal


The terminal should pop up at the bottom of the page by default, and type the following commands to configure your git username and email.
git config --global user.email "your_user_email_address"
git config --global user.name "your_S/I/C_number"


Image 29: Configure git


 

Final Step: Clone your first project into SAP Business Application Studio.

We are almost done with the tutorial now. Visit your project page on github and copy the link to your project.


Image 30: Copy your git project url address


Once the link has been copied to the clipboard, we can head on over to SAP Business Application Studio and on the welcome tab of SAP Business Application Studio click on the clone from git button and when the text box pops up at the top of the page, paste the link we copied earlier. Alternatively, go to the terminal and type
git clone <the link you copied>


Image 31: Clone from git with link


 

If you followed all the steps correctly, you should see that the project has been successfully cloned in the terminal as shown below.


Image 32: Successful git clone


You have successfully cloned your first project from the corporate github. Breathe a sigh of relief and grab a glass of juice and chill. If you face any issues while setting up the connections, please leave a comment and I'll get back to you ASAP.

Happy coding!!!

14 Comments