Skip to Content
Technical Articles

Migration of a Git Repository from a Trial SCP Account to another SCP Account without losing Commit History

Like many developers, you certainly started doing some test or real projects in the SAP Web IDE of your SCP trial account before moving to a new not-trial-anymore SCP account. In some cases, you may have used a Git repository from within your trial account and committed to it all the history of your project. And now, you wonder how to migrate your Git trial repository to your new fresh Git repository without losing your commit history.

This how-to will introduce you the procedure to manage to do it. Let’s start!

Prerequisites

At the time being, we have not found a SCP tool to achieve it. Therefore, you need to have a Git client installed on your local computer in order to follow the hereafter procedure. You can find the official Git client here or get it through your favorite package manager (Chocolatey for instance).

You also need to carefully check with your SCP administrator that you have all the rights required to operate your SCP target account Git service, especially the right to push to it.

Finally, you have an empty (= without any commit) Git repository in your target SCP account.

Step by step

Clone your trial repository to your local computer 

From the command line, use your Git client to clone your trial repository to your local computer.

git clone https://git.hanatrial.ondemand.com/##########/mydemoproject

You should get something like this:

Cloning into 'mydemoproject'...
remote: Counting objects: 11, done
remote: Finding sources: 100% (11/11)
remote: Total 11 (delta 0), reused 11 (delta 0)
Unpacking objects: 100% (11/11), done.

Modify the remote target of your local repository

From the command line, change directory to the new cloned repository and execute these two commands which modify the target of the remote Git server.

git remote rm origin
git remote add origin https://git.eu3.hana.ondemand.com/########/foo

Take great care at this point that the new added remote refers to your target SCP account and not your trial SCP account.

Push the local repository to the target remote repository

From the command line, push now the local cloned repository to your target SCP repository.

git push --set-upstream origin master

You should get something like this:

Enumerating objects: 11, dne.
Counting objects: 100% (11/11), done.
Delta compression using up to 4 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (11/11), 1.16 KiB | 132.00 KiB/s, done.
Total 11 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1)
remote: Processing changes: refs: 1, done
To https://git.hana.ondemand.com/########/foo 
* [new branch]      master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.

If no error occurs during the push process, have a look at your target SCP Git repository and you will see your full project history in it.


That’s all Folks!

P.S. I would like to thank my colleague Joseph Berthe with whom I collaborate to find the right way to do it.

4 Comments
You must be Logged on to comment or reply to a post.