Follow the steps below to set up the development environment on your client machine.
Create a Linux Foundation Account
Follow the instructions on the identity portal to create a Linux Foundation account and get access to the OpenECOMP Gerrit instance. Then verify that you can log in at https://gerrit.openecomp.org/ and that you can see the OpenECOMP list of repositories.
Linux Setup
<<TODO: describe a Linux client set-up for Git and git-review>>
To install git-review on Linux (Ubuntu), type the following command.
sudo apt-get install git-review
Windows Setup
Installing Git
Install Git on your client, visit: https://www.atlassian.com/git/tutorials/install-git, and download the appropriate installation image for your host. Once downloaded, execute the installation script ("open" the .msi file).
During installation, you will see the following dialog box. Include the "Git Bash" and "Git GUI" components (this is the default).To do this, leave the following boxes checked:
If you intend to type Git commands from the Windows Command Prompt, leave the default setting for adjusting the PATH environment:
The repositories use Unix-style line-feed for line termination, so on your windows Git client, select the conversion option:
Select the following option based on your own preference (non-default shown, so 'winpty' is not required):
Choose the defaults here:
The installer lets you choose the experimental 'difftool'; either choice will work. Continue with the installation dialogs until the installation is complete.
Install Python on Windows
Download Python version 2.7.10:
Execute the install file that you just downloaded. (You must have administrative privileges.) During installation, select "Add python.exe to Path", overriding the default setting. Also, be sure to install "pip" (this is the default).
Continue with the installation until it is completed.
Set up git review
Run Git Bash as Administrator (for example, in Windows 10, use the Windows menu, scroll to the Git directory, right-click on Git-bash, and select "Run as administrator":
Within Git Bash, type the following command:
$ pip install git-review
To use git review
, you have to be in a git clone directory that already contains a (possibly hidden) .gitreview
configuration file (see Gerrit/Advanced usage#Setting up a repository for git-remote), otherwise you will get the error message UnboundLocalError: local variable 'no_git_dir' referenced before assignment.
The git and git-review installation steps above are derived from the description at: https://www.mediawiki.org/wiki/Gerrit/git-review#Windows
Configure Git to remember your Linux Foundation user name and email address (the user name and email address associated with your Linux Foundation login):
git config --global user.email <your_LF_account_email>
git config --global --add gitreview.username
<your_LF_user_name>
If you are using VPN, you might encounter a proxy problem while connecting to the Linux Foundation website. To avoid the problem, you should add the proxy setting in git config, using the following command:
git config --global https.proxy https://<proxy username>:<proxy password>@<proxy url>
git config --global http.proxy http://<proxy username>:<proxy password>@<proxy url>
NOTE: When entering the proxy username, you might be required to add the domain name in front of the username.
Install Putty
NOTE: If you already have keys registered with PuTTY, skip this section.
PuTTY is a terminal emulator that uses Secure SHell (SSH) to communicate with a host. You need to install PuTTY in order to create a public/private encryption key pair. This pair of keys enables git to communicate securely with the repositories.
To install PuTTY, visit, www.putty.org and follow the links to the appropriate Windows installation for your machine (32-bit or 64 bit). The downloaded file will be named putty-0.67-installer.msi
or the like.
Execute the .msi
file. Use all the default settings, thereby ensuring that you will install pageant.exe
, plink.exe
, and puttygen.exe
.
Generate Public and Private Keys
The puttygen
utility, installed with putty
, generates public and private keys used for secure communication with Gerrit.
You should execute puttygen.exe
as an Administrator, otherwise, the key files will be stored in %localappdata%\VirtualStore\PuTTY
, typically C:\Users\<user>\AppData\Local\VirtualStore\Program Files (x86)\PuTTY.
To do this, right-click on C:\Program Files (x86)\PuTTY\puttygen.exe
and select Run as Administrator:
Answer "Yes" to the User Account Control challenge. Then click the "Generate" button in the puttygen window. puttygen will ask you to move your mouse over its dialog box to generate random seed bits. After it has computed a public key, it will display a dialog box resembling the following:
If you want to edit this key pair in the future, create a text file containing a short phrase, called a "passphrase". Copy and paste this passphrase into the "Key passphrase" and "Confirm passphrase" lines, then select "Save public key" and choose a filename (e.g. public.txt); also "Save private key" and choose another filename (e.g. private.ppk). Since you ran puttygen
as Administrator, the files are visible to Windows Explorer.
Close puttygen
.
Load Your Private Key Into Pageant
Pageant is an SSH authentication agent. It holds your private keys in memory, already decoded, so that you can use them often without needing to type a passphrase.
To load your private key into pageant
, right-click on the private key file (e.g. private.ppk
in this example), and select Load into pageant
:
This action not only loads private.ppk
into pageant, but also starts pageant if it is not already running. You will be prompted for the passphrase that you entered into puttygen
when you created the key. If successful, pageant will load the key without further interaction.
pageant
runs without opening any visible window. When it is running, it puts an icon of a computer wearing a hat ( ) into the System tray.
You can right-click on this icon to perform actions with pageant, including "View Keys" (which brings up a dialog box that allows you to add or remove keys.)
The "Add Key" button offers another way to enter your private key into pegeant: after clicking on "Add Key", select the file containing your private key (for example, private.ppk
).
Set the GIT_SSH Environment Variable
From the Desktop, right-click the Windows logo at the very bottom left corner of the screen, , and select "System". Within the System dialog box, select "Advanced system settings" to get the Power User Task Menu.
In the next dialog box, select "Environment Variables":
If you don't already have a GIT_SSH entry in your System Variables list, click "New..." and create GIT_SSH, defined to be the location of plink.exe
:
Copy/paste the known_hosts entries listed, into a file named known_hosts under your .ssh profile (something like C:\Users\<my-id>\.ssh) (if known_hosts does not exist, create it).
Selecting a connection method
Once Git is installed, you will need to select a connection method to the Gerrit host, https://gerrit.openecomp.org/.
We recommend using SSH, in which case you need to register your private key in your account settings on the Gerrit host.
SSH Connection (Recommended)
Log in to the Gerrit host https://gerrit.openecomp.org/, pull down the menu under your user name (at the extreme top right of the browser window), click on "Settings" and select "SSH Public Keys". Enter the private PuTTY key you generated above.
HTTPS Connection (Alternate)
If you choose to use HTTP/HTTPS, you'll need to generate an access password. To do so, In your Gerrit account settings, select HTTP Password:
The icon at the right of the generated password allows you to copy the generated password to your clipboard, it will be needed when you interact with git/gerrit.
This password may have a limited time to live, so you might get errors like this one:
Problem running 'git remote update gerrit'
Fetching gerrit
fatal: unable to access 'https://USERNAME@gerrit.openecomp.org/r/a/mso/ ': Unknown SSL protocol error in connection to gerrit.openecomp.org:443 error: Could not fetch gerrit
Regenerating a password will most likely solve the connectivity issue. Sometime, the Gerrit interface on HTTPS might be temporarily faulty, so retries might be needed.
Cloning the Repository by Using the Command Line
- Add a remote pointer to the Gerrit server that hosts your repository using either SSH or HTTPS. (Users behind a VPN will prefer the HTTPS method, since most VPNs won't allow an ssh connection.)
Using SSH:git remote add origin ssh://USERNAME@gerrit.openecomp.org:29418/<REPONAME>
Using HTTPS:
With HTTPS, first you will need the Gerrit HTTP-generated password for each HTTPS operation with Git/Gerrit.git remote add origin
htt
ps://USERNAME@gerrit.openecomp.org/r/a/<REPONAME>
- Now clone the remote repository (because the repo already contains a commit from the Linux Foundation team that created it). Since we clone in the current folder, it will create a sub folder with the remote copy.
Using SSH:git clone ssh://USERNAME@gerrit.openecomp.org:29418/<REPONAME>
Using HTTPS:
With HTTPS, first you will need the Gerrit HTTP-generated password for each HTTPS operation with Git/Gerrit.git clone https://USERNAME@gerrit.openecomp.org/r/a/<REPONAME>
Installing the Gerrit plugin in IntelliJ
Open File -> Settings -> Plugins of IntelliJ, and click on the Browse repositories... button.
In the new window, search for Gerrit, click Install to install the plugin, and finally restart IntelliJ.
To verify whether the Gerrit plugin is installed successfully, you can click File -> New -> Project from Version Control and verify whether Gerrit is present.
Working with a Proxy
For people working with a proxy, you might have proxy issues connecting to Linux Foundation website. To avoid the connection issue, you shall define the proxy setting for both IntelliJ and Git.
To configure the proxy settings in IntelliJ, click File -> Settings -> Appearance & Behavior -> System Settings -> HTTP Proxy, enter the correct proxy settings and click Apply. In case of Manual proxy configuration, while entering the Host name, there is no need to write http:// in front of the URL. For example, if the proxy value is http://one.proxy.com, you shall putone.proxy.com as the Host name.
To configure the proxy settings for Git, play the following command:
git config --global https.proxy https://<proxy username>:<proxy password>@<proxy url>
git config --global http.proxy http://<proxy username>:<proxy password>@<proxy url>
Note: while entering proxy username, sometimes it may require to add the domain name in front.