How To Connect Your Corporate Github To SAP Business Application Studio
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.
- You should have a dev space in SAP Business Application studio. Follow this link if you don’t have that setup already.
- You should have a corporate or enterprise github account and a project to clone.
- You should have SAP Cloud Connector installed on your local machine and be able to access it through your browser.
- Generate personal access token from the corporate github.
- Connect SAP Cloud Platform to the cloud connector by adding a subaccount.
- Create a mapping to the corporate github from the cloud connector.
- Create a destination in SAP Cloud Platform to connect to the cloud connector.
- Create the .netrc file and fill it with the right credentials.
- Configure git with your email and user name.
- 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.
On the settings page, select personal access token and then click the Generate New Token button.
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.
Click the Generate Token button at the bottom of the page.
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.
Step 2: Connect SAP Cloud Platform to the cloud connector.
Visit the hana trial cockpit, and 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.
On the trial subaccount page, note down the ID value under the subdomain as this will be used in setting up the cloud connector.
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.
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.
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.
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.
Follow the wizard and provide the details as you can see in the next image.
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.
Now fill in the wizard that opens to look like the next image.
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.
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.
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.
Assign the roles shown in the next image, essentially all the roles related to SAP Business Application Studio, Connectivity and Cloud connector.
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.
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.
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.
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.
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.
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.
When the text box dialog pops up, type in .netrc and hit the enter key on the keyboard or click the OK button.
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
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.
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"
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.
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>
If you followed all the steps correctly, you should see that the project has been successfully cloned in the terminal as shown below.
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.