Liferay: Líder no Quadrante Mágico da Gartner pelo sexto ano consecutivo! Leia mais aqui
« Voltar para Contributing

Contribute using Git and GitHub

Initial setup and configuration #

GitHub Account #

Make an account on GitHub. A variety of plans are available, but a free account works just fine.

Set up Git #

Install Git following instructions from: Generating SSH Keys

Setup your personal info in local Git repo:

  • Email:
git config --global ""
  • Name:
git config --global "Your Name"

Set SSH keys and add it to the GitHub account. For help, see GitHub's article

Retrieve Liferay source code #

Fork Liferay repositories #

Fork both the Liferay Portal and Liferay Plugins repositories to your GitHub account. Do this by visiting the repositories at the links below and then click the "Fork" button. You must be signed in to fork the repositories.

Clone forked repositories #

Clone your own forked GitHub repos. Go to a location on your computer that you wish to have a copy of the Liferay Portal and Liferay Plugins source stored. This could be a "Development" directory within your user's home directory, for example. Once in this location, issue the following git commands to clone your forked repositories to your computer:

git clone ssh://
git clone ssh://

This may take a long time depending on your network connectivity -- grab a cup of coffee and wait it out.

Once it completes, you will see two new directories - liferay-portal and liferay-plugins. Inside each of these directories is the source code for each.

Configure remote upstream #

Set the remote upstream repository for both liferay-portal and liferay-plugins. Run the command below inside the liferay-portal directory. Then, change "liferay-portal.git" to "liferay-plugins.git" and run the command in the liferay-plugins directory, too.

git remote add upstream git://

Configure local master #

Create local master branch from the upstream. Run the command below inside the liferay-portal directory. Then, change to the liferay-plugins directory and run the same command.

git checkout -b master "upstream/master"

Now we have 3 repositories each for liferay-portal and liferay-plugins: local (on your computer), origin (your fork on GitHub) and the upstream (the main owned by Liferay on GitHub).

Sync changes from upstream #

If the main repository changes, you will need to sync changes from upstream. You can accomplish this with the following commands:

  • Get all the updates from upstream
git fetch upstream
  • Switch to the master branch
git checkout master
  • Rebase the master branch. With rebase, all local commits are stashed and applied after the fetch
git pull --rebase upstream master
  • Push the updates to origin
git push origin master

Now the local, origin, and upstream repositories are all current

0 Anexos
29009 Visualizações
Média (2 Votos)
A média da avaliação é 5.0 estrelas de 5.
Respostas do tópico Autor Data
While Configuring local master, using git... Tejas Kanani 12 de Setembro de 2012 20:09
Hi Tejas, the point of that command is to... Oussama Denden 27 de Dezembro de 2012 01:34
If I understand the goals, the step "Configure... Mauro Mariuzzo 25 de Fevereiro de 2013 00:35

While Configuring local master, using
git checkout -b master "upstream/master"

getting below error.
fatal: git checkout: updating paths is incompatible with switching branches.
Did you intend to checkout 'upstream/master' which can not be resolved as commit?

Any idea what is going wrong ?
Postado em 12/09/12 20:09.
Hi Tejas,
the point of that command is to create a new branch in which u would do whatever u want to do with liferay source code so doing something like git checkout -b fix_something would be enough
Postado em 27/12/12 01:34.
If I understand the goals, the step "Configure local master" is a way to have a branch of origin with the contributed code.

So we can do:
git checkout -b "branch name" "origin/master"

And to contribute the code we have to create a pull from that branch.

I'm right?
Postado em 25/02/13 00:35.