Products

Get Going with Git

By palomor

GitBy default, Polarion installs and uses a Subversion repository. But what if you have some codebase in an external repository… a Git repo, for example? And if you’re new to Git, how do you set up a repository? This post provides a few practical tips to help you get Git, and once you’ve got Git, get going 🙂 so you can link Git revisions to Polarion Work Items.

The Git project is hosted on: http://git-scm.com/ There are download links for Windows and Linux versions.

The Windows version uses a GUI application called GIT GUI for creating a repository. On Linux, you can use the console application GIT BASH to follow the Linux tutorial, which is also available online at: http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html.

Setting up a Git repository


For Polarion’s internal testing of the external repositories feature with a cloned Git repository, our QA team created a repository on www.github.com. Let’s say this repo is called test2, and the user name is test2YourName.

With the repository created on github.com, there are some steps needed on the client side.

1. Global setup

Download and install GIT. Then use the command line to run:

git config –global user.name “YourName”
git config –global user.email your.name@yourdomain.com

2. Local initialization

Run the following from the command line:

mkdir test2
cd test2
git init
touch README
git add README
git commit -m ‘first commit’
git remote add origin git@github.com:YourName/test2.git
git push -u origin master

Need to access an existing GIT Repo? Run this on the command line:

cd existing_git_repo
git remote add origin git@github.com:UserName/RepoName.git
git push -u origin master

Authentication on Windows


GIT uses the SSH authentification method. You can find info on SSH setup for Windows at http://help.github.com/win-set-up-git/

If you will configure Polarion to use your GIT repository, and if Polarion is running as a service (the preferred way unless you’re just running Polarion for an evaluation), you’ll need to add the HOME system variable pointing to the location where the .ssh folder is created. If you need a refreshed on how to add a system variable, check out: http://www.itechtalk.com/thread3595.html.

Git it Working With Polarion


By default, Polarion uses the Subversion (SVN) repository that was bundled with the distribution and installed with the platform. This Default repository is used for all projects. The assumption is that development code bases are managed in this same SVN repository. However, if you have code bases managed in another repository, you can configure your Polarion project to enable linking of Polarion Work Items (Default repository) to revisions in the external repository. External repositories can be either Git or Subversion.

How to configure your Polarion Project for Git
The Repositories Configuration topic in project Administration enables you to specify one or more external repositories so that revisions there can be linked to Polarion Work Items in the project. It’s possible to configure more than one external repository, and you can have both Subversion and Git repositories.

Here’s the step-by-step to for configuring Polarion to work with a Git repository:


  1. Log in with administrator permissions for the project you want to configure to use a Git repository, and open the project. (Enter Administration if your login did not already take you into it.)

  2. In Navigation, select Repositories Configuration

  3. In the Repositories Configuration page, click the Add New Repository button.

  4. In the Provider list, select Git. When you select the repository type, a set of fields specific to the selected type appears below the list control. In this case, you’ll see the fields for Git.

  5. Fill in the fields with data specific to the repository you want the Polarion project to access, noting the required fields marked with a red asterisk (*).
    Comment: Local Repository is the location of the “.git” folder on the filesystem in your git repository clone.

  6. Click the Save button to save the configuration settings.


It’s important to remember that the Default SVN repository is always used by Polarion to store Work Items and other Polarion data. If you have source code for the project in this repository as well as in the external Git repository, then after adding the external Git repository(ies) to the configuration, you must explicitly add the Default repository back to the project configuration. If you don’t do that, then users won’t be able to link source code revisions in the Default repository to Work Items. In this case, you would repeat the above steps selecting Default in the Provider list.

We learned a few things about Git as our development team got Polarion working with it in version 2011-SR1. But we’re still more Git Newbie than Git Expert (Subversion has been our thing). If you’ve got a good tip for people who are just getting going with Git – please post a comment!

Robert Palomo

Comments

One thought about “Get Going with Git
  • Since this post things have changed a bit in version 2012. Navigation path is: Administration > Repositories, and there are some changes to the config pages. Check the embedded help on the administration pages and the online Help topic Administrator’s Guide: Configuring Repositories for the latest info.

Leave a Reply

This article first appeared on the Siemens Digital Industries Software blog at https://blogs.stage.sw.siemens.com/polarion/get-going-with-git/