Você está na página 1de 22

GIT HUB Plugin Setup in ANYPOINT Studio

GIT HUB Plugin Setup in ANYPOINT Studio

Author
Sudha CH

Page no: 1

GIT HUB Plugin Setup in ANYPOINT Studio

ABSTRACT
I would like to provide you a complete overview on installation steps of GitHub.
I have provided the information from scratch to cloning of the existing projects
available in the GitHub. Please go through the detailed steps mentioned below
which would make the installation, saving a project, creating a repository,
committing and pushing changes to the repository etc This would make your life
easy by following the steps.
Please do comment on our blog, if you have any suggestion related to the book,
I would like to know more about the recommendation from users for our further
books.

Page no: 2

GIT HUB Plugin Setup in ANYPOINT Studio

Table of Contents
1. Introduction to GitHub ............................................................................ 4
2. Advantages of GitHub ............................................................................. 5
2.1 GitHub Plugin Setup in Anypoint Studio ........................................ 6
2.2 Saving a Studio Project to Git .......................................................... 8
2.3 Registering a Local Repository ...................................................... 11
2.4 Committing Changes to the Local Repository .............................. 13
2.5 Committing and Pushing to a Remote Repository ....................... 14
2.6 Importing a Git Project into Studio ................................................ 15
2.7 Importing from a Local Drive......................................................... 15
2.8 Importing From a Remote Repository ........................................... 17
2.9 Cloning and Pulling from a Remote Repository ........................... 19
3. References............................................................................................... 22

Page no: 3

GIT HUB Plugin Setup in ANYPOINT Studio

1. Introduction to GitHub
GitHub is a Web-based Git repository hosting service. It offers all of the distributed revision
control and source code management (SCM) functionality of Git as well as adding its own
features. Unlike Git, which is strictly a command-line tool, GitHub provides a Web-based
graphical interface and desktop as well as mobile integration. It also provides access control and
several collaboration features such as bug tracking, feature requests, task management,
and wikis for every project
A user must create an account in order to contribute content to the site, but public repositories
can be browsed and downloaded by anyone. With a registered user account, users are able to
discuss, manage, create repositories, submit contributions to others' repositories, and review
changes to code

Page no: 4

GIT HUB Plugin Setup in ANYPOINT Studio

2. Advantages of GitHub
GitHub is mostly used for code.
In addition to source code, GitHub supports the following formats and features:

Documentation, including automatically-rendered README files in a variety of Markdownlike file formats (see README files on GitHub)

Issue tracking (including feature requests) with labels, milestones, assignees and a search
engine.

Pull requests with code review and comments.

Integrations Directory
Unified and split diffs.

Email notifications.

Option to subscribe someone to notifications by @ mentioning them.


Small Websites can be hosted from public repositories on GitHub. The URL format is
http://username.github.io.

Nested task-lists within files


Visualization of geospatial data* 3D render files that can be previewed using a new
integrated STL file viewer that displays the files on a 3D canvas. The viewer is powered
by WebGL and Three.js.

So, Git is a version control system, Version control systems keep these revisions straight, and
store the modifications in a central repository. This allows developers to easily collaborate, as
they can download a new version of the software, make changes, and upload the newest revision.
Every developer can see these new changes, download them, and contribute.

Repository
A repository is a location where all the files for a particular project are stored, usually
abbreviated to repo. Each project will have its own repo, and can be accessed by a unique
URL.

Page no: 5

GIT HUB Plugin Setup in ANYPOINT Studio

2.1 GitHub Plugin Setup in Anypoint Studio


The following are the steps that need to be followed when installing GitHub plugin in Anypoint
Studio
1. In Studio, click the Help menu, then select Install New Software
2. In the Work with field of the Available Software panel, use the drop-down menu to select
http://download.eclipse.org/egit/updates-2.1
3. In the table below the Work with field, click the check boxes associated with Eclipse Git
Team Provider and JGit.
4. Click the expand arrow to the left of both Eclipse Git Team Provider and JGit and in the
submenus that appear, then click to deselect the following three items:
EGit Mylyn
Eclipse EGit - Source
Eclipse JGit - Source
Eclipse Plugin- in Import Support

5. Click Next to continue.

Page no: 6

GIT HUB Plugin Setup in ANYPOINT Studio

6. In the Install Details panel, click Next to continue installation.

7. In the Review Licenses panel, select I accept the terms of the license agreement, and then
click Finish.

8. After Mule has installed the Egit plugin, click Yes to complete the installation and restart Studio.

Page no: 7

GIT HUB Plugin Setup in ANYPOINT Studio

2.2 Saving a Studio Project to Git


You can create a Git repository so that multiple developers can save changes to a Studio project in one
shared location. To do so, you must first create and register a Git repository.
Creating a Local Repository
1. In the Package Explorer, right click the name of your project, go to Team, then select Share Project

2. A new wizard to select the repository plugin that will be used to share the selected project and click
Next. (If multiple plugins are installed)

Page no: 8

GIT HUB Plugin Setup in ANYPOINT Studio

3. In the Configure Git Repository wizard, click Create

4. In the Create a Git Repository panel, click Browse then navigate to the git folder on your local drive

Page no: 9

GIT HUB Plugin Setup in ANYPOINT Studio

5. Mule populates the fields in the Configure Git Repository panel to correspond with the folder you
created for your new Git repository on your local drive. Check the box next to your projects line item
in the list, then click Finish.

6. In the Mule Studio Package Explorer, notice the small question mark icon that appears next to your
project name (below). This icon indicates that you have created a Git repository for your project on
your local drive, but you have not yet registered it and are not yet tracking changes to the project.

Page no: 10

GIT HUB Plugin Setup in ANYPOINT Studio

2.3 Registering a Local Repository


1. In the Package Explorer, right click the name of your project; navigate to Team, then select Commit.

If you have not yet identified yourself to Git as a user, the Identify Yourself panel may appear at this
point. Enter a User name and User e-mail that Git can use to identify you and the commits that you make
to your Git repository.

2. In the Commit Changes panel, commit the inaugural version of your Studio project which will
effectively register the project on your local drive. In the Commit message field, enter a description of
Page no: 11

GIT HUB Plugin Setup in ANYPOINT Studio

the project you are about to commit to the repository. (In the future, when you commit changes to the
project to your repository, use the Commit message field to record the changes that you have made to
the project since your last commit.

3. In the Files pane, notice that Mule has applied a question mark icon to each of the items in
the list. This icon indicates that the file is "untracked" in Git (i.e. the file has not yet been
saved in the repository). Click the checkbox next to each item to select all of them.

4. Click Commit to save your project in your new Git repository


5. In the Package Explorer, notice that Mule applies a barrel icon to your project name (below). This
icon indicates that you have committed this project to a Git repository.

Page no: 12

GIT HUB Plugin Setup in ANYPOINT Studio

2.4 Committing Changes to the Local Repository


After making changes to your Studio project and saving in Mule, you can commit changes to the
project in your local Git repository.
1. First, save the changes you have made to your Studio project in Mule (File > Save).
2. In the Package Explorer, notice that Mule applies a chevron in front of your project name
(below). This icon indicates that you have made changes to your Studio project but have not
yet committed those changes to your Git repository.
3. In the Package Explorer, right click the name of your project, go to Team, and
select Commit.
4. In the Commit message field of the Commit Changes panel, enter notes to describe what you
have added or changed in the Studio project.

5. Click the box next to all items listed in the Files pane, then click Commit to save your changes to
your local Git repository.

Page no: 13

GIT HUB Plugin Setup in ANYPOINT Studio

2.5 Committing and Pushing to a Remote Repository


When multiple people work on a Studio project, they must all synchronize changes through the
remote Git repository. Within Studio, you can push your latest commits to a project to the remote
Git repository.
1. If your project is already being tracked on a remote Git repository, you must first Cloning
and Pulling from a Remote Repository of your project from the remote repository before
proceeding to step 2. This ensures that the commits you are about to push contain all the
project changes that others have previously committed to the remote repository
2. Follow the steps above to commit your changes locally.
3. In the Package Explorer, right-click the name of your project, navigate to Team, then
select Push to Upstream.
4. Mule pushes your commits to the remote Git repository, and then presents a Push
Results panel that describes the commits you have pushed. Click OK.

Page no: 14

GIT HUB Plugin Setup in ANYPOINT Studio

2.6 Importing a Git Project into Studio


Studio offers two ways to import a project from a Git repository:

If you have already cloned your Git repository and stored it on your local drive, follow the
procedure for importing a Project from a Local Drive.

If you have not yet cloned your Git repository and stored it on your local drive, follow the
procedure for Importing From a Remote Repository

2.7 Importing from a Local Drive


1. In Studio, under the File menu, select Import

2.

In the Import wizard, click the expand arrow next to the Git folder, and then select Projects
from Git.
3. Click Next to continue.

4. In the Import Projects from Git wizard, select Local, and then click next.
5. Click to select a Git repository from the list of repositories on your local drive, and then
click next.
6. Select Import existing projects from the list of import methods, then click to select
the Working Directory folder

Page no: 15

GIT HUB Plugin Setup in ANYPOINT Studio

7. Click Next

8. Use the drop-down menu in the Working sets field to select the project you wish to import,
and then click Finish.
9. Known Issue: Under the Projects menu, select Clean to scrub the project and ensure that
Studio has created a consistent build path.

10. Under the File menu, select Open, then navigate to the cloned repository on your hard drive
to open your project and work with it in Studio.

Page no: 16

GIT HUB Plugin Setup in ANYPOINT Studio

2.8 Importing From a Remote Repository


1. In Studio, under the File menu, select Import
2. In the Import wizard, click the expand arrow next to the Git folder, and then select Projects
from Git.
3. Click Next to continue.

4. In the Import Projects from Git wizard, select URI, and then click Next.
5. In the URI field, identify your user name and the name of your Git repository. Use the
following format to enter the information:git@github.com:username/repository-name.git.
When you enter this information, Studio automatically completes the remaining required fields
in the panel.

6. Click Next.
7. In the list of branches in your Git repository, click the boxes next to the branch (or branches) of
your project that you wish to check out and work on in Studio.
8. Click Next to continue.
9. Select the directory on your local drive to which you want to clone and save your project, then
click Next. Git clones the branch(es) you selected and stores them on your local drive.

Page no: 17

GIT HUB Plugin Setup in ANYPOINT Studio

10. Select Import existing projects from the list of import methods, select the working

Directory folder, then click Next

11. Use the drop-down menu in the Working sets field to select the project you wish to import, and
then click Finish.
12. Known Issue: Under the Projects menu, select Clean to scrub the project and ensure that Studio
has created a consistent build path
13. Under the File menu, select Open then navigate to the cloned repository on your hard drive to
open your project and work with it in Studio.

Page no: 18

GIT HUB Plugin Setup in ANYPOINT Studio

2.9 Cloning and Pulling from a Remote Repository


For multiple people to collaborate on a Studio project, everyone must synchronize their changes
through a remote Git repository. To work on your project locally within Studio, clone, and then
pull the latest version of a project from a remote Git repository.
1. In Studio, close all the Message Flow tabs of the project you are about to pull from your remote
Git repository.
2. In Package Explorer, right-click the name of your project, navigate to Team, then select Pull
3. Mule pulls the project from the remote repository, and then it presents a Pull Result panel that
describes the changes others have made to the project since your last pull.
4. Click OK.

5. In Package Explorer, double-click the name of the flow(s) in your project to reopen them on
your Studio canvas.
How to fork a Repository

Fork: A fork is a copy of a repository. Forking a repository allows you to freely experiment with
changes without affecting the original project.

How to Fork a repository in two processes


1. On GitHub, navigate to the octocat/Spoon-Knife repository.
2. In the top-right corner of the page, click Fork.

Page no: 19

GIT HUB Plugin Setup in ANYPOINT Studio

Lets us walk through the step by step process of Forking


Step 1: Set Up Git
If you haven't yet, you should first set up Git. Don't forget to set up authentication to GitHub
from Git as well
Step 2: Create a local clone of your fork
Right now, you have a fork of the Spoon-Knife repository, but you don't have the files in that
repository on your computer. Let's create a clone of your fork locally on your computer,
a. On GitHub, navigate to your fork of the Spoon-Knife repository.
b. In the right sidebar of your fork's repository page, click to copy the clone URL for your
fork.
c. In Command prompt type git clone and then paste the URL you copied
$git clone https://github.com/SUDHA_CH/Spoon-Knife
Cloning into `Spoon-Knife`...
# remote: Counting objects: 10, done.
# remote: Compressing objects: 100% (8/8), done.
# remove: Total 10 (delta 1), reused 10 (delta 1)
# Unpacking objects: 100% (10/10), done.

Step 3: Configure Git to sync your fork with the original Spoon-Knife repository
When you fork a project in order to propose changes to the original repository, you can configure
Git to pull changes from the original, or upstream, repository into the local clone of your fork
1. On GitHub, navigate to the octocat/Spoon-Knife repository.
2. In the right sidebar of the repository page, click to copy the clone URL for the repository.
3. In Command prompt Change directories to the location of the fork you cloned
To go to your home directory, type just cd with no other text.
To list the files and folders in your current directory, type ls.
To go into one of your listed directories, type cd your_listed_directory.
To go up one directory, type cd...

Page no: 20

GIT HUB Plugin Setup in ANYPOINT Studio

4.

Type git remote -v and press Enter. You'll see the current configured remote repository
for your fork.
git remote -v
# origin https://github.com/ SUDHA_CH/SUDHA_CLONE.git (fetch)
# origin https://github.com/ SUDHA_CH/SUDHA_CLONE.git (push)

5. Type git remote add upstream, and then paste the URL you copied in Step 2 and press
Enter. It will look like this:
git remote add upstream https://github.com/octocat/Spoon-Knife.git

6. To verify the new upstream repository you've specified for your fork, type git remote -v
again. You should see the URL for your fork as origin, and the URL for the original
repository as upstream.
git remote -v
# origin https://github.com/SUDHA_CH/SUDHA_CLONE.git (fetch)
# origin https://github.com/ SUDHA_CH/SUDHA_CLONE.git (push)
# upstream https://github.com/ SUDHA_CH/SUDHA_CLONE.git (fetch)
# upstream https://github.com/ SUDHA_CH/SUDHA_CLONE.git (push)

Page no: 21

GIT HUB Plugin Setup in ANYPOINT Studio

3. References
Please refer to the below site for more information on using GitHub

1.
2.
3.
4.

https://github.com/
http://stackoverflow.com/questions/tagged/github
https://docs.mulesoft.com/mule-user-guide/v/3.3/using-git-with-studio
http://mulesoft.github.io/magento-connector/

Page no: 22

Você também pode gostar