Skip to Content
Technical Articles
Author's profile photo Samuel Davies

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.

 

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%201%3A%20Select%20settings%20from%20the%20context%20meny

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%202%3A%20Click%20generate%20new%20token

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%203%3A%20Provide%20name%20and%20choose%20scopes

Image 3: Provide name and choose scopes

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

Image%204%3A%20Click%20generate%20token%20button

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%205%3A%20Copy%20the%20generated%20token%20and%20note%20it%20down

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%206%3A%20Click%20the%20enter%20your%20trial%20account%20button

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%207%3A%20Note%20down%20your%20region%20and%20provider

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%208%3A%20Note%20down%20the%20ID%20value%20of%20your%20subaccount

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%209%3A%20Login%20to%20your%20cloud%20connector

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%2010%3A%20Define%20the%20subaccount%20with%20these%20details

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%2011%3A%20Cloud%20connector%20connected%20to%20SCP

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%2012%3A%20Click%20add%20mapping%20button

Image 12: Click add mapping button

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

Image%2013%3A%20Follow%20wizard%20with%20these%20details

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%2014%3A%20Add%20resource%20path%20to%20the%20mapping

Image 14: Add resource path to the mapping

 

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

Image%2015%3A%20Fill%20in%20the%20wizard%20with%20these%20details

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%2016%3A%20Confirm%20that%20the%20mapping%20is%20reachable

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%2017%3A%20Select%20your%20user%20from%20the%20list%20of%20users

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%2018%3A%20Assign%20roles%20to%20your%20user

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%2019%3A%20Assign%20remaining%20roles%20to%20your%20user

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%2020%3A%20Create%20new%20destination%20and%20fill%20details

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%2021%3A%20Ignore%20this%20error%20message.

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%2022%3A%20Click%20on%20your%20trial%20dev%20space

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%2023%3A%20Open%20user%20folder%20in%20BAS

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%2024%3A%20Choose%20user%20folder%20from%20dialog.

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%2025%3A%20Choose%20New%20File

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%2026%3A%20Enter%20.netrc%20in%20textbox

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%2027%3A%20Enter%20the%20credentials%20in%20.netrc%20file

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%2028%3A%20Open%20a%20new%20terminal

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%2029%3A%20Configure%20git

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%2030%3A%20Copy%20your%20git%20project%20url%20address

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%2031%3A%20Clone%20from%20git%20with%20link

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%2032%3A%20Successful%20git%20clone

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!!!

Assigned tags

      12 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Hemsagar Elugu
      Hemsagar Elugu

      Hello Samuel Davies

      Followed all the steps But iam getting Received HTTP code 502 from proxy after CONNECT error.

      Author's profile photo Even Song
      Even Song

      Same issue, getting Received HTTP code 502 from proxy after CONNECT error.

      Author's profile photo Hemsagar Elugu
      Hemsagar Elugu

      Issue resolved after opening Ports.

      Author's profile photo Samuel Davies
      Samuel Davies
      Blog Post Author

      Thanks for the answer Hemsagar Elugu, Even Song can you please confirm if your error was resolved after opening the ports?

      Author's profile photo Jonas Wang
      Jonas Wang

      Hi Hemsagar,

      Do you mind sharing the detail on how you resolve the issue? I am having the same issue.

       

      Author's profile photo Hemsagar Elugu
      Hemsagar Elugu

      Hi Jonas Wang  We Enabled Open connection between SAP Cloud Connector and SAP Business application studio. This connection is needed to integrate Business application studio with Git HUB enterprise.

      Source: SAP  Cloud Connector URL

      Destination:

      scpcfdev1.us10cf.applicationstudio.cloud.sap

      connectivity.us10.applicationstudio.cloud.sap

      Port: 8443 ,443

      Regards

      Hem

      Author's profile photo Jonas Wang
      Jonas Wang

      Hi Hemsagar,

      Thanks for getting back to me. What do you mean by "Enabled Open Connection between SAP Cloud Connector and SAP Business application stuido"? Is this an configuration in the cloud connector?

       

      Regards

      Jonas

      Author's profile photo Hemsagar Elugu
      Hemsagar Elugu

      Hi Jones,

      Need to Allow Firewall Traffic l. You can check with your IT team.

      Author's profile photo Jonas Wang
      Jonas Wang

      Thanks for explanation. I talked to our IT team and was able to resolve the issue.

      Author's profile photo Hemsagar Elugu
      Hemsagar Elugu

      Yes it was resolved

      Author's profile photo Kapil Vijay
      Kapil Vijay

      I installed cloud connector but it throws an error could not open service manager. Secondly, how do I obtain login credentials for cloud connector?

      Author's profile photo Joseph BERTHE
      Joseph BERTHE

      Hello,

      thanks for this blog. I tried to do it but I get the following error :

      git: 'credential-netrc' is not a git command. See 'git --help'.
      fatal: Authentication failed for 'https://<server_url>/directory/project/_git/Demo1/'

      What is the problem ?

      Kind regards,

      Jospeh