UPDATE 2018
There is a much better way to solve the problem outlined in this blog (than the method I outlined below). It is nicely explained by
arnaldo.cavazos in the OpenSAP course
SAP Cloud Platform Version Control with Git. See
Week1, Unit 4: Cloning Strategies: Creating and Connecting Orphaned Repositories
In short the steps are:
- In Web IDE, right click on your orphaned repository and choose GIT->Initialize Local Repository.
- In the GIT pane (Web IDE) Stage all changes and Commit
- Create a new repository in the SAP Cloud Platform GIT service (or another service like Git Hub or Bitbucket). Copy the repository URL to clipboard
- In Web IDE, right click on your orphaned repository and choose GIT->Set Remote. Paste in the repo. url
- In the GIT pane (Web IDE) do a rebase
- Now you can push your changes to the remote repository
What's the problem?
A couple of months ago I started development of a bespoke Fiori app which was to run on the HANA Cloud Platform (HCP). To be more specific it would run on SAP Fiori, Cloud Edition (SFCE).
As the sole developer I didn't think much about the Git repository features on HCP. I just created my project from a template in Web IDE. When I deployed it to HCP I chose a name for the html5 application. A corresponding Git repository was created.
Now (with 2 bespoke apps live) I am lucky enough to have a team mate. When he cloned this repository (using the Git Pane in Web IDE) and then fetched and re-based (to retrieve my source code) he saw......an empty folder.
I'm not an expert on Git. I think the best way to explain what happened was that
deploying my code did not commit my changes. Indeed the only commit that appears is the 'Initial empty repository' commit (go to the
Versioning page in your html5 application and see the
History section to see this).
When you create your first project you should link it to the GIT repository right away, as
michal.keidar explains here
SAP Web IDE – Deployment to SAP HANA Cloud Platform Explained
If, dear reader, you didn't do this, then this blog is for you.
I will explain how I linked my existing project to the corresponding Git repository and committed all of my code, so that my team mate could work on it too.
What's the solution?
1) Export your code from Web IDE (to the file system). Right click on your project (in Web IDE), choose
Export. This is important as
you don't want to loose your code
2) Right click on your project and choose
Delete. Don't worry, you just saved a backup of your code
3) Close the Web IDE browser tab
4) Go to
HTML5 Applications in the HCP Cockpit (under the
Applications Node)
5) Select the HTML5 application (by clicking on the name) and go to
Versioning in the menu (on the left hand side). Under the
Source Location section click
Edit Online.
This opens Web IDE and you will see a dialog like this:
6) The repository details have been pre-populated (I have replaced the actual 'GUID' here with a dummy one). Enter your s-account username and password and click
OK (you can leave the port blank). The following dialog should appear:
7) Choose
Commit and Push. Web IDE creates a new project in your workspace. Because there won't have been a commit of all your changes the folder will be empty (except for a .gitignore file)
8) In Web IDE import your folders and files from the file system. To do this right click on your project (in Web IDE), choose
Import->Import from File System. Choose the zip file which you saved in step #1. You should see this dialog:
9) Click OK on the dialog. Now you should see your complete project in Web IDE
10) In the Git pane (right-hand-side) click
Stage All and enter a comment
11) Click
Commit and Push. Choose
origin/master branch. If you have errors (from the JS lint) you can override by clicking
Push on the dialog. Now you will see your commit in the GIT repository
12) Now your team mate can clone your repository and make changes to the application