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 GitHub 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.
I plan a series of related blogs that will describe how to use additional Git services, such as BitBucket, as Git repositories for a SAP Web IDE project as well as relevant tips & tricks.
2015-12-13 Update: Want to use Bitbucket as your Project Repository with SAP Web IDE?
In this blog I will discuss:
- Creating the repository
- Cloning the repository
Creating the Git Repository
When working with external Git repositories, and with GitHub 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 GitHub:
- Login to your GitHub account.
- Create a new repository.
- Fill in the repository fields, mainly Repository name, description, public/private, etc.
Important: Don’t forget to check the “Initialize this repository with a README”.
Cloning the Git Repository
Steps to clone the Git repository from GitHub:
- In your GitHub account, select the repository to clone and 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” and “Repository Path” fields are filled-in automatically.
- Fill-in the authentication fields. You’re welcome to check the “Remember Me” checkbox for next times.
- 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 project was generated in SAP Web IDE that was cloned from GitHub. You can see that, as expected, the project only contains the README.md file.
Open the Git History pane. You’ll see that it contains one commit, the initial commit. If you click on the commit, you’ll see that it only contains one file, README.md that was added to the repository (Status – A).
Summary & Next Steps
Cloning from an external Git repository is simple, specifically with GitHub.
The major difference from the SAP HCP Git is:
- You need to create the Git repository in GitHub prior to the start of development.
- You need to check the “Initialize this repository with a README” checkbox during creation of the repository.
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.