Today I am going to discuss about the MTA project Integration with GitHub as a source control in SAP Business Application Studio: HANA XSA. earlier I discussed integration with Web IDE which is slide difference.
SAP Business Application studio support Personal access tokens instead of passwords and to access GitHub repo in a SAP Business Application Studio we need create an access token on GitHub
Before perform the steps, I want everybody know the flow and keep the diagram so that you have a clear concept on this migration –
Integration Steps :
1. Collect of GitHub credential : Username,Github,email if from GitHub and generate personal access tokens. Click Developer settings -> In the left sidebar, under Personal access tokens -> click Fine-grained tokens. Click Generate new token. Copy the token and save the token very carefully.
2. Set up Git repo credential in Business application Studio :
Open anew terminal and initiate the git and clone your existing repository from GitHub
.
You can use the below commands as per requirement.
3. Create a remote repository : The remote repository then will be available to your workspace. You can use the below commands as per requirement.
user: PALLAB_MTA $ git init
user: PALLAB_MTA $ git config --global user.email "pallab_haldar@hotmail.com"
user: PALLAB_MTA $ git config --global user.name "Pallab_hal_01"
user: PALLAB_MTA $ git remote add projectm https://github.com/pallabhaldar/HANA2.0.git
user: PALLAB_MTA $ curl -H 'Authorization: <my token generated>1' 'https://github.com/pallabhaldar/HANA2.0.git/'
user: PALLAB_MTA $ git status
On branch master
No commits yet
user: PALLAB_MTA $ git remote
projectm
user: PALLAB_MTA $ git remote -v
projectm https://github.com/pallabhaldar/HANA2.0.git (fetch)
projectm https://github.com/pallabhaldar/HANA2.0.git (push)
user: PALLAB_MTA $ git commit -m "first Comment"
[master (root-commit) a195b9c] first Comment
3 files changed, 7 insertions(+)
create mode 100644 .gitignore
create mode 100644 .vscode/settings.json
create mode 100644 mta.yaml
user: PALLAB_MTA $ git push --set-upstream projectm master
3. Pull Operation : you can use using graphical interface or use terminal to execute commands.
git remote add projectm https://github.com/pallabhaldar/HANA2.0.git
git pull projectm
git clone <repository url>
git fetch
git fetch -all
git checkout Branch1
git clone —-branch Branch1 <https://github.com/pallabhaldar/HANA2.0.git
git branch –Branch1
$ git checkout -t projectm/Branch1
4. Push Code from BAS to Git : Before Push Pull(step) , add and commit to local repository :
git init
cd BranchL
git add -A
git commit -m “My first Commit"
Push
git remote add projectm https://github.com/pallabhaldar/HANA2.0.git
git push -u projectm BranchL :Branch1
5. Other git command that can be useful for different operations :
git clone /path/to/repository
git clone username@host:/path/to/repository
git add <filename>
git add *
git commit -m "Commit message"
git commit -a
git push origin master
git status
git remote add origin <server>
git remote -v
git checkout -b <branchname>
git checkout <branchname>
git branch
git branch -d <branchname>
git push origin <branchname>
git push --all origin
git push origin :<branchname>
git pull
git merge <branchname>
git diff
git diff --base <filename>
git diff <sourcebranch> <targetbranch>
git add <filename>
git tag 1.0.0 <commitID>
git log
git push --tags origin
git checkout -- <filename>
git fetch origin
git reset --hard origin/master
Hope this blog will useful to the daily git users in HANA.