Skip to Content

Commit your project files to your HCP Git repository


Commit your project files to your HCP Git repository

By akula86

Learn how to commit and push your project files to the Git repository built into your HCP account.

You will learn

Git is a widely used source code management system for software development, and is built into your SAP HANA Cloud Platform account, and integrated with SAP Web IDE.


There are many reasons why you might want to use a source code management tool. Some obvious ones are:

  • You made a mistake during development and want to return to a previous version of a file (or all)
  • Capture the state of code for a deployed application
  • Work in a development team and need to merge changes from individual “branches” of the code into the “main line” of the code stream

In this tutorial, you will learn how to commit and “push” your project files to your Git repository. In addition to being a good idea, your project files will need to be in Git for the next tutorial where you will Localize your SAPUI5 app

As you work through this tutorial (and afterwards) you will notice some Git “decorations” or icons indicating Git status starting to appear next to your files and folders. There are six different states which are indicated as shown in the table below. Watch for the decorations to change from New file > Modified and Staged > Committed. After a commit, any changes in a file will be indicated with one asterisk (indicating that the file is out of sync with the version in Git).

Decoration Meaning
committed Committed file (version in your project matches that in Git)
modified not staged Modified file that has not been staged
modified staged Modified file that has been staged
committed New file
deleted files Folder containing deleted files
conflicts File with merge conflicts

  1. Open your HCP Cockpit view, click on Repositories > Git Repositories.

    Git Repositories
  2. Click on New Repository, and enter the following:

    Field Value
    Name northwind
    Description Repository for northwind app

    Make sure the Create empty commit box is checked, click OK and your repository will be created.

    Create repo image
  3. Click on the northwind repository link to open the repository overview page.

    Created repo
  4. On the repository overview page, copy the Git Repository URL:

    Git repo URL
  5. Open SAP Web IDE in a browser window, and open your project folder (northwind). Note that there are no decorations next to your files.

    project files with no Git status
  6. Right-click on your northwind project folder and select Git > Initialize Local Repository.

    Initialize local git
  7. Paste in the Git Repository URL you copied earlier and click OK. This will initialize your local repository and link it to the Git repository in HCP.

    Initialize with remote git URL
  8. Click on the Git pane icon on the right hand side of the SAP Web IDE window.

    If your project does not appear in the Git pane, keep the Git pane open and click on the project folder.

    Git pane
  9. So you can see remote branches in the HCP Git repository, click the Fetch button on the Git pane and log in with your HCP account credentials if prompted. When the Changes Fetched dialog box opens, click OK.

    Git Fetch
  10. Click the Merge button on the Git pane to merge your local branch to the remote origin/master branch. When the Merge “master” dialog box opens, make sure the origin/master remote branch is selected and click OK.

    Git MergeGit Merge master
  11. You will now notice that the new file decorations are visible on your project files.

    Git decorations

    At this point your Git repository is set up. The next steps will commit and push your project files to the repository.

  12. You may select individual files to commit, but to commit all project files, click the Stage All checkbox.

    staging all files

    Notice the change in the decorations for your files and folders.

    staged decorations
  13. Scroll down in the Git pane and enter a description (required for any commits). A description like Initial commit of northwind app would work well.

    commit description
  14. Click on the Commit and Push button, and select Remote Branch, from the pop up menu. This will add your files to the master branch (in other source control systems this is sometimes referred to as the “trunk”).

    commit description
  15. In the Push Changes to a remote branch dialog box, select origin/master, click OK and log in with your HCP credentials if prompted.

    commit description
  16. You will see a confirmation alert appear briefly in the top-right corner of the Web IDE window (just below Logout), and you will see the decorations change to the green circles indicating that the files have been committed (and the version in your project matches the version in the Git repository).

    commit description

Next Steps

Updated 12/08/2016

Time to Complete

5 min

Back to top