cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to Connect Eclipse with Git or abapGit and Push ABAP Code to GitHub for ABAP Cloud project

Ayyaparaja
Explorer
0 Likes
5,782

I'm working on an ABAP development project and would like to integrate version control using GitHub.

I’m specifically looking to push ABAP code to GitHub directly from Eclipse using either Git or the abapGit plugin.

What I've done so far:

I'm trying to understand:

  • Can I push ABAP code directly from Eclipse ADT to GitHub?

  • If yes, what are the exact steps to do this using either Git or abapGit in Eclipse?

  • If not, what is the recommended way to use GitHub for ABAP version control (especially in ABAP cloud  project)?

Accepted Solutions (1)

Accepted Solutions (1)

Aarnavpant
Product and Topic Expert
Product and Topic Expert

Hi @Ayyaparaja ,

Yes, you can absolutely push ABAP code directly from Eclipse ADT to a GitHub repository. Based on the plugins you've installed, the correct tool for this is the abapGit plugin for ADT.

Here is a comprehensive guide to help you link your repository and manage your code.

Prerequisites in GitHub
Before you begin in ADT, please complete the following steps in GitHub:

  1. Create a New Repository: If you haven't already, create a new repository. It is recommended to initialize it with a README.md file. This ensures that a default branch (e.g., main or master) is created, which is required for the initial linking process in ADT.
  2. Copy the Repository URL: Copy the HTTPS URL of your repository. You will need this to link it within ADT.
  3. Generate a Personal Access Token (PAT): If you are connecting to a private repository on github.com or an internal company instance (like github.tools.sap), you must generate a Personal Access Token. This token will be used instead of your password for authentication from ADT. Ensure the token has the necessary scopes (e.g., repo) to allow read and write access to the repository.


Linking Your Repository in ADT
Follow these steps to link your local ABAP package to the remote Git repository:

  1. Open the abapGit Repositories View: In ADT, use the shortcut Ctrl+3 (for Windows) or Cmd+3 (for macOS) and type abapGit Repositories to open the view. This view lists all the repository links set up in your ABAP system.
  2. Initiate a New Repository Link: In the top-right corner of the "abapGit Repositories" view, click the +
  3. Screenshot 2025-06-09 030354.png (Add) icon. This will start the process to link a new remote repository to an ABAP package

Please Note: This "linking" step does not clone or pull any code. It simply establishes a persistent connection between a specific ABAP package and a specific branch of your Git repository. The current architecture permits a one-to-one relationship; one package can be linked to only one repository branch at a time.


Complete the "Link Repository" Wizard:

  1. Repository URL: On the first page of the wizard, paste the repository URL you copied from GitHub.
  2. Authentication: If the repository is private or on an internal enterprise server, you will be prompted for credentials. Enter your GitHub username and use the Personal Access Token (PAT) you generated as your password.
  3. Branch and Package Selection: Choose the specific repository Branch you want to work with and select the ABAP Package you wish to link it to. All Git operations, such as pulling and pushing, will be performed between this selected pair.
  4. Initial Pull Option: If you are linking a repository for the first time to an empty package, it is recommended to uncheck the "Pull after link" option to maintain clear separation of steps. You can perform a pull manually later.
  5. Folder Logic Selection: The next page defines the "Folder Logic." This crucial setting determines the folder structure of your ABAP objects within the Git repository.
    FULL: Creates a folder structure that mirrors the ABAP object hierarchy (e.g., /src/zcl_my_class.clas.abap). This is a common and intuitive choice.
    PREFIX: Uses the package name as a top-level folder for all objects.
    NAMESPACE: Uses the SAP namespace (e.g., /0CUST/) as the top-level folder.
    Choose the logic that best suits your project's standards. For most use cases, FULL is recommended.
  6. Finalize the Link: After selecting the folder logic, click Finish. Your ABAP package and Git repository branch are now successfully linked.

 

Performing Git Operations
Once the link is established, you can perform standard Git operations from the context menu of the linked repository.

Screenshot 2025-06-09 030221.png

For Pulling Changes from the Repository
If the remote repository contains objects that are not yet in your ABAP system, you can pull them.

  1. Right-click on the linked repository in the "abapGit Repositories" view and select "Pull".
  2. The wizard will connect to the remote repository and show you a list of ABAP objects that are available to be imported.
  3. Select the objects you wish to import into your package.
  4. Click Continue and then Finish to complete the pull process. The selected objects will be created or updated in your ABAP system.


For Pushing Your Changes to the Repository

  1. After making changes to ABAP objects within your linked package, right-click on the repository link and choose the Stage and Push option.
  2. This action will open the "abapGit Staging" view. This view displays all modified, created, or deleted objects (both code and non-code files) in your local package that differ from the current state of the repository branch.
  3. Select the changes you wish to commit. You can add individual files or all changes to the "Staged Changes" area by using the + icon.
  4. In the "Commit Message" box, write a clear and concise message describing the changes you are pushing.
  5. Once you have staged your desired files and written a commit message, click the Commit and Push button to transfer your changes to the remote GitHub repository.

Please let me know if there is any other information I can help you with.
Thanks,
Aarnav

Ayyaparaja
Explorer
Hi @Aarnavpant, Thanks for sharing the detailed steps and explanation.
Hmungania
Discoverer
0 Likes
Make sure after creating the repository on Github. You add README.md file. otherwise when you add the repo link to abagit repository it wont work. make sure the repository is not empty.

Answers (3)

Answers (3)

mainak-aich
Participant

Hi @Ayyaparaja ,

The short answer is yes, it is possible to push ABAP code to Git e.g. Github. You need abapgit to be installed which I presume you have done. Just follow the steps. 

1. Create a new repository in github and get the link of the repository.

2. Note down your github user and password. Also, create a token. (path is profile->settings->Developer settings->personal access token)

3. In the Eclipst ADT, open github repositories view and link your package to the repository. (You should be seeing a + button for this in this view). Use the package which has all the objects you want to push to github. Don't select the checkbox, pull after link. 

4. Once successfully linked, open another view github Staging. Then the current repository content should be shown. If not, you need to select your repository by clicking on the golden cylinder button on top right and select the repository you linked in step 3.

5. Once the repository is selected, all the unstaged changed objects will be shown. You need select all or part and click on the + button to stage it.

6. Once staged, you need to write a commit message and click on "Commit and Push" button. The github user id and password prompt will appear. Enter the one mentioned in step 2. 

Once push is over, you will be able to view your objects inside the github repository you used in step 1.

Thanks,
Mainak

Ayyaparaja
Explorer
0 Likes
Hi @mainak-aich, Thanks for sharing the detailed steps.
SabineReich
Product and Topic Expert
Product and Topic Expert

Hi,

there's another tutorial on GitHub that might help:

https://developers.sap.com/tutorials/abap-environment-abapgit-transfer..html

 

Ayyaparaja
Explorer
0 Likes
Hi @SabineReich, Thanks for sharing the tutorial.
wolfgang_woehrle
Product and Topic Expert
Product and Topic Expert

Hi,

this tutorial provides information about how to install the abapGit Plugin to transfer ABAP development objects between a Git repository and an SAP S/4HANA Cloud, ABAP Environment instance or an SAP BTP, ABAP Environment instance.

Does this help?

Kind regards,

Wolfgang

Ayyaparaja
Explorer
0 Likes

Hi Wolfgang,

Thanks for sharing the tutorial — it was helpful for installing the abapGit plugin in Eclipse.

However, I could only find the installation steps.
Could you please share the steps to connect Eclipse with a Git repository for ABAP code?

I'm specifically looking to understand how to push ABAP code from Eclipse (ADT) to GitHub for version control.

Thanks in advance!

wolfgang_woehrle
Product and Topic Expert
Product and Topic Expert
0 Likes
Hi, I am sorry, that I did not see that you already had installed the plug-in that I recommended you. I am already in contact with our expert and we try to get back to a.s.a.p. Kind regards, Wolfgang