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: 
RazK
Product and Topic Expert
Product and Topic Expert

Introduction


From time to time, I get asked the question “Can I use an external Git with SAP Web IDE?”


When working with SAP Web IDE I recommend using the integrated SAP HCP Git (Look in the Summary section for some of the reasons).


However, SAP Web IDE enables the use of an external Git as well.


As lidor.tal mentions in his excellent blog post How to Use the SAP Web IDE Git Client, the first thing you have to do to work with Git, is to have a Git repository in your SAP Web IDE workspace”. However, the examples in Lidor’s blog post, use the SAP HCP Git server that is well integrated with SAP Web IDE.


This blog post describes how to use Bitbucket as an external Git as the project repository with SAP Web IDE. It is part of a series of blogs that discuss Git and SAP Web IDE.




  • It is NOT intended to teach Git. For this there are plenty of resources on the web, specifically with most Git services, you’ll find an education section.

  • It is NOT intended to educate on SAP Web IDE Git client functionality.


This is the second blog post in a series of related blogs that will describe how to use additional Git services as Git repositories for a SAP Web IDE project as well as relevant tips & tricks. In the previous blog post Want to use GitHub as your Project Repository with SAP Web IDE? I presented how to use GitHub as a project repository with SAP Web IDE.

Overview


In this blog I will discuss:

  • Creating the repository

  • Cloning the repository


 

Creating the Git Repository


When working with external Git repositories, and with Bitbucket specifically, the first step is to create the repository. This step is probably the only thing that is substantially different from working with the SAP HCP Git. The reason for this is that when working with external Git, the Git repository creation is done through the Git service, while with the SAP HCP Git when creating an HTML5 application in the HCP cockpit or when deploying to HCP from the SAP Web IDE, it is automatically created for you. Steps to create the Git repository on Bitbucket:

  • Login to your Bitbucket account.

  • Create a new repository.


Following are several ways to create a new repository:







  • Fill in the repository fields, mainly Repository name, description, public/private, etc.

  • Click the "Create repository" button.


Note:  Unlike GitHub, Bitbucket does not provide the option to initialize the repository upon creation. As a result, once the repository is created, you'll need to go through an additional step of repository initialization prior to cloning it in SAP Web IDE.




  • Initialize the newly created Bitbucket repository. This is the only additional step you need to make compared to GitHub. Everything you need to do is documented in the webpage that opens after you click on the "Create repository" button in the previous step.

  • Click the "I'm starting from scratch" for teh steps you need to make.




  • Make sure you have a Git client installed on your machine.

  • Then go through the first set of console commands. I use Windows for this blog.




  • Going through the first set of commands:




  • Going through the second set of commands:




Now, that the Git repository is initialized I can proceed to cloning it in SAP Web IDE.

Cloning the Git Repository


Steps to clone the Git repository from Bitbucket:




  • In your Bitbucket account, select the repository to clone.




  • Copy the repository link.




  • In SAP Web IDE, choose the “Clone Repository” option.




  • In the URL field of the popup, paste the GitHub repository link and push <Tab> button.


Note: The “Host”, “Repository Path”, "Protocol" and "User" fields are filled-in automatically.




  • Fill-in the authentication fields. You’re welcome to check the “Remember Me” checkbox for next times.

  • Click "OK".

  • After clicking “OK” you’ll get notifications both in the console pane as well as in the “Highlighted Announcement Area” of the SAP Web IDE. You will see them at the beginning of the clone operation as well as at the completion.




  • A new option is available with the latest release of the SAP Web IDE enabling you to "Git Ignore System Files". You're welcome to choose either of the options per your work standards.



Congrats !!!


A new project was generated in SAP Web IDE that was cloned from Bitbucket. You can see that, as expected, the project only contains the contributors.txt file.


Open the Git History pane. Since I chose the "Ignore System Files" options, you’ll see that it contains two commits, the initial commit and the igonre commit. If you click on the initial commit, you’ll see that it only contains one file, contributors.txt that was added to the repository (Status – A).



 

Summary & Next Steps


Cloning from an external Git repository is simple.


Bitbucket is somewhat more complicated than GitHub as it requires the additional steps for initializing the repository.


 


The major difference from the SAP HCP Git is:




  • You need to create the Git repository in Bitbucket prior to the start of development.

  • You need to check initialize the repository using a Git client.


 

OK, now that the project is cloned in SAP Web IDE, what can I do next?Following are a few options:

  • Import a project.

  • Create a project from template.

  • ...


 

A few things to note when working with external Git

  • You cannot deploy from SAP Web IDE to HCP.

  • Creation of branches, and possibly additional repostiroy management operations, should be done via the Git service UI / client.


-- Raz



3 Comments