Committing Code in Eclipse and Creating a Merge Request
If EGit is installed on your local Eclipse, you can commit the local Git repository code to CodeArts Repo. CodeArts Repo supports only Eclipse 4.4 and later versions.
- For the first push:
- Create a repository on the local computer, that is, the local repository.
- Commit the update to the local repository.
- Pull the code from the server to the local repository, merge the code, and push the repository to the server. After remote commit is complete.
- If it is not the first push:
- Commit the modified code to the local repository.
- Pull the code from the server to the local repository, merge the code, and push the repository to the server.
Step 1: Installing EGit on Eclipse
Perform the following steps to install Eclipse 4.4:
On the Eclipse toolbar, choose Install window that is displayed, click Add..., enter EGit in Name and EGit plug-in address in Location, click OK, and click Next > until the installation is complete. After the installation is complete, restart Eclipse.
. In theStep 2: Configuring EGit on Eclipse
- On the Eclipse toolbar, choose User Settings information.
- Click OK.
email indicates the bound email address. If the username is not set previously, set it in this step.
Step 3: Creating a Project and Committing Code to the Local Git Repository
- Create the git_demo project and the HelloWorld.java class.
- Share the git_demo project with the local repository.
- In the Share Project window displayed, select Git.
- Click Next >. In the Configure Git Repository dialog box, select Use or create repository in parent folder of project and click Create Repository.
- Click Create Repository to create a Git repository.
The directory is in the untracked status, indicated by a question mark (?).
Choose
to commit code to the local repository. - In the Commit Changes dialog box displayed, set the commit message.
- Click Commit to commit the code to the local repository.
Step 4: Committing Code in the Local Repository to the Remote Git Repository
- Create a repositor in CodeArts Repo. For details, see Overview.
Go to the repository details page and copy the repository URL.
- Choose
- In the Push to Another Repository dialog box, set the parameters.
- Click Next. The Push Ref Specifications dialog box is displayed.
- Click Add Spec.
- Click Next. The Push Confirmation dialog box is displayed.
- Click Finish.
- Click OK.
Log in to the remote repository and check the submitted code.
When Eclipse connects to the repository of CodeArts Repo using HTTPS, the message "Transport Error: cannot get remote repository refs. XXX.git: cannot open git-upload-pack" is displayed. This is because the EGit plug-in configuration in Eclipse is incorrect. Solution: Right-click in Eclipse and choose Windows > Preferences > Team > Git > Configuration > User Settings from the shortcut menu. Click Add Entry, set Key to http.sslVerify, and set Value to false.
Step 5: Creating a Merge Request in CodeArts Repo
Go to the homepage of the repository where a merge request is to be created, choose Merge Requests > Create MR, and select the source and target branches. The lower part of the Create MR page displays the file differences of the two branches and the commit records of the source branch.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot