seshukm | 311c432 | 2017-11-06 11:48:22 +0530 | [diff] [blame] | 1 | .. This work is licensed under a Creative Commons Attribution 4.0 International License.
|
| 2 | .. http://creativecommons.org/licenses/by/4.0
|
| 3 | .. Copyright 2017 Huawei Technologies Co., Ltd.
|
| 4 |
|
| 5 | Configure git and gerrit
|
| 6 | ========================
|
| 7 |
|
| 8 | Basics
|
| 9 | ------
|
| 10 | The recommended version of git is 2.7.4 or later. Check the installed version in the Ubuntu VM:
|
| 11 |
|
| 12 | .. code-block:: bash
|
| 13 |
|
| 14 | git --version
|
| 15 |
|
| 16 | Create an SSH key to user with gerrit. Use no passphrase.
|
| 17 |
|
| 18 | .. code-block:: bash
|
| 19 |
|
| 20 | ssh-keygen -t rsa
|
| 21 |
|
| 22 | Enter your SSH public key (id_rsa) into gerrit:
|
| 23 | Browse to https://gerrit.onap.org
|
| 24 | Log in
|
| 25 | Open the menu next to your name (under the green search button)
|
| 26 |
|
| 27 | .. image:: images/Configure_git_1.png
|
| 28 |
|
| 29 | Select "Settings"
|
| 30 | In the "Settings" sidebar, click "SSH Public Keys"`
|
| 31 | Click "Add Key..."
|
| 32 | Paste the entire contents of $HOME/.ssh/id_rsa.pub into the text area and click "Add".
|
| 33 |
|
| 34 | .. image:: images/Configure_git_2.png
|
| 35 |
|
| 36 | Install the git-review package.
|
| 37 |
|
| 38 | .. code-block:: bash
|
| 39 |
|
| 40 | sudo apt update
|
| 41 | sudo apt install git-review
|
| 42 |
|
| 43 | Create $HOME/.gitconfig (replace highlighted values with your own information):
|
| 44 | [user]
|
| 45 |
|
| 46 | name = FirstName LastName
|
| 47 |
|
| 48 | email = you@yourcompany.com
|
| 49 |
|
| 50 | [core]
|
| 51 |
|
| 52 | autocrlf = false
|
| 53 |
|
| 54 | [merge]
|
| 55 |
|
| 56 | tool = vimdiff
|
| 57 |
|
| 58 | [gitreview]
|
| 59 |
|
| 60 | username = YourLinuxFoundationId
|
| 61 |
|
| 62 | **If you're behind a corporate firewall and your proxy server has SOCKS support...**
|
| 63 |
|
| 64 | You may be able to use the SSH protocol with git, which is preferred versus HTTP. This method is known to work in the AT&T corporate network.
|
| 65 | Install the socat package, which allows you to tunnel SSH connections through a proxy that supports SOCKS:
|
| 66 |
|
| 67 | .. code-block:: bash
|
| 68 |
|
| 69 | sudo apt update
|
| 70 | sudo apt install socat
|
| 71 |
|
| 72 | Create (or append to) $HOME/.ssh/config (replace highlighted values with your information)
|
| 73 |
|
| 74 | Host gerrit.onap.org
|
| 75 |
|
| 76 | User userid
|
| 77 |
|
| 78 | Hostname gerrit.onap.org
|
| 79 |
|
| 80 | ProxyCommand socat - PROXY:host:%h:%p,proxyport=port
|
| 81 |
|
| 82 | IdentityFile /home/userid/.ssh/id_rsa
|
| 83 |
|
| 84 | ServerAliveInterval 10
|
| 85 |
|
| 86 | Verify that you have connectivity to gerrit through the proxy. Answer "yes" to continue connecting, if prompted.
|
| 87 |
|
| 88 | .. code-block:: bash
|
| 89 |
|
| 90 | ssh -p 29418 gerrit.onap.org
|
| 91 |
|
| 92 | .. image:: images/Configure_git_3.png |