Setting up Development Environment


1 Setting up Gerrit access

This section provides information about initial configuration operations of Gerrit access, including the following aspects:

  • How to register contact information
  • How to configure Secure Shell (SSH)
  • How to configure Git


1.1 Registering Contact Information

To register contact information, perform the following procedure:

  1. Log in to Tizen Gerrit.
  2. Click Settings to open the Settings web page.
  3. In Contact Information, enter email address and full name, then click Register.
    Gerrit will send a verification email to the email address.
  4. Verify the email address by following the link in the verification email.
    At this point, the Gerrit account is activated and ready for use.
    Note: If an error message is received upon clicking the link in verification email, copy the link to the address bar of the browser directly.


1.2 Configuring SSH for Gerrit Access

To configure SSH for Gerrit access, perform the following procedure:

  1. Generate RSA keys by executing the following command:

    $ ssh-keygen [-t rsa] [-C ""]
    

    Note: "[-t rsa]" and "[-C ""]" are both optional arguments for ssh-keygen command.

    If invoked, without specifying key type, ssh-keygen command will generate an RSA key for use in SSH protocol 2 connections, thus making "[-t rsa]" that specifies the key type optional.

    For RSA key, if invoked without adding any comment, ssh-keygen command initializes the comment as "@" when the key is generated, thus making "[-C ""]" optional. In spite of this, adding this argument is recommended because a rephrased comment can help better identify the keys.

    Follow the on-screen prompt below to specify the file in which to save the key. When pressing ENTER directly, the default value "/home//.ssh/id_rsa" is used, as  shown in the parentheses.

    Enter file in which to save the key (/home//.ssh/id_rsa):
    

    Then follow the on-screen prompt below to set a passphrase. Pressing ENTER directly indicates no passphrase, as shown in the parentheses.

    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:

    At this piont, the SSH keys are successfully generated.

  2. Create an SSH configuration file with a full path of "~/.ssh/config" by using text editor and add the following content:
    Host tizen
      Hostname review.tizen.org
      IdentityFile ~/.ssh/id_rsa
      User 
      Port 29418
    
      #The line below is optional configuration applicable to Ubuntu and openSUSE.
      #Add when using proxy, otherwise, skip it.
      #ProxyCommand nc -X5 -x : %h %p
    
      #The line below is optional configuration applicable to Fedora.
      #Add when using proxy, otherwise, skip it.
      #ProxyCommand nc --proxy-type socks4 --proxy : %h %p
    
  3. Upload your SSH public key to Gerrit.
    a) In the Gerrit web page, click Settings, then click SSH Public Keys in the left panel to display the SSH Public Keys web page.
    b) Open SSH public key file by using the text editor. An example using VIM is shown below:      

    $ vim ~/.ssh/id_rsa.pub

    c) Copy the content in public key file, paste it to the Add SSH Public Key box, and click Add.

    The example below indicates that the SSH Public key has been uploaded successfully.

  4. Verify SSH Connection by executing the following command:
    $ ssh tizen

    The message below indicates that SSH connection has been established successfully.

      ****    Welcome to Gerrit Code Review    ****
       ...


1.3 Configuring Git for Gerrit Access

Git must know the user's name and email address to determine the author of each commit. If the user name or email address is not set up in a way that Git can find it, the user may encounter some odd warnings.

This configuration operation requires developer access. In additon, matching the email address with the one registered in contact information, which helps Git determine a user, is recommended,

To configure Git for Gerrit access, perform the following procedure:

  1. Set the user name by executing the following command:

    $ git config --global user.name 
    
  2. Set the email address by executing the following command:
    $ git config --global user.email ""

Note: Using the GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL environment variables is an alternative solution. These variables override all configuration settings once set.


2 Working through Network Proxy (Optional)


2.1 Configuring Proxy

To configure proxy through Linux shell prompt, perform the following procedure:

  1. Open .bashrc file by using text editor.
    Here's an example using VIM:              

    $ vim .bashrc
    
  2. Set the HTTP_PROXY, FTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables by adding the following content in the .bashrc file.
    export HTTP_PROXY=:
    export FTP_PROXY=$http_proxy
    export HTTPS_PROXY=:
    export NO_PROXY=<Internal Address>


2.2 Configuring Git Access through Proxy

To allow Git access through the firewall, perform the following procedure:

  1. Create a script named "git-proxy" in "/usr/local/bin" directory by using text editor.
    Here's an example using VIM:                

    $ sudo vim /usr/local/bin/git-proxy
  2. Add the content below and save the file.
    #!/bin/bash
    
       PROXY=
       PORT=<Port>
    
       case $1 in
        # list git servers here that you do not want to use
        # the proxy with, separated by a pipe character '|' as below:
    
       review.tizen.org)
           METHOD="-X connect"
        		;;
        *)
           METHOD="-X 5 -x ${PROXY}:${PORT}"
           #The line above is applicable to Ubuntu and openSUSE.
           #For Fedora, use the variation below since it only supports socks v4.
           #METHOD="-X 4 -x ${PROXY}:${PORT}"
          		;;
       esac
    
       nc $METHOD $*
  3. Change the attribute of git-proxy script to make it executable by executing the following command:
    sudo chmod +x /usr/local/bin/git-proxy
  4. Set GIT_PROXY_COMMAND and GIT_PROXY_IGNORE environment variables by adding the following content in the .bashrc file.
    export GIT_PROXY_COMMAND=/usr/local/bin/git-proxy
    export GIT_PROXY_IGNORE=
    
  5. Open a new terminal and run the bash command to apply the change.