Page tree
Skip to end of metadata
Go to start of metadata

This is a work-in-progress guide intended to help those that need to use Windows as their developer environment. It will address whatever issues developers commonly face, with hints/tools that have been tested and are in use by other OPNFV developers.

Setting up Git and Gerrit

Source: Bryan Sullivan, AT&T

There are multiple ways to get git/gerrit working on Windows. Here are two:

  1. Use Git for Windows
  2. Run a linux under VirtualBox, and use the guides for Linux (TO BE DESCRIBED)

Using Git for Windows

This procedure will be clarified as needed and will be re-tested to make sure nothing is missing, superfluous, or redundant. Any input is appreciated.

  • Install Putty (the ZIP file or installer package) from
  • If you don't have a public/private key pair yet, run PuTTYgen and generate a pair
  • Start Pageant and import your private key ("Add Key")
  • Assuming you have already created a gerrit account for the project/org, add your public key to the account through the gerrit UI, e.g.
  • Install Git for Windows from
  • Run Git Bash. Further commands below are run in the git bash shell.
  • Create/edit your .bashrc file using vi or your editor. .bashrc sets up your bash environment when you run Git Bash
    • vi ~/.bashrc

      PATH=$PATH:"/C/Program Files/Git/bin"
      eval `ssh-agent`
      # add my private key
      ssh-add (path to your private key, e.g. /c/files/my-key)
      # (optional) go to your git clone home dir
      cd (path to where you clone repos, e.g. /c/files/git)
  • Run your .bashrc file, and enter the password to your private key file when prompted

  • source ~/.bashrc


  • Create an ssh config file using vi or your editor
vi ~/.ssh/config
Host (your git/gerrit host, e.g.
Hostname (your git/gerrit host, e.g.
User (your gerrit ID)
IdentityFile (path to your private key, e.g. e.g. /c/files/my-key)
  • Create/edit your .gitconfig file using vi or your editor.
vi ~/.gitconfig
filter "lfs"
clean = git-lfs clean %f
smudge = git-lfs smudge %f
required = true
name = (your gerrit ID)
email = (your email)
  • If you are behind a corporate or other proxy, set the proxy in the git config
git config --global http.proxy (your proxy, e.g.
  • If you want to turn off the proxy (e.g. to use git outside your corporate network), edit the .gitconfig file and comment out the proxy line
vi ~/.gitconfig
proxy =
  • Add your gerrit ID to your git config

    git config --global --add gitreview.username "(your gerrit ID)"
  • Copy the commit-msg hook to your git config
scp -p -P 29418 (your gerrit ID)@(your gerrit server domain, e.g. .git/hooks
  • If you do not have ssh access you can also get this via http
    curl -Lo .git/hooks/commit-msg
    chmod +x .git/hooks/commit-msg
  • Install Python (3.5 or greater) per the "Windows" section of
    • Select "Add to Path" option

    • Leave other options as-is, e.g. to ensure pip is installed also
  • Exit and re-enter git bash, to pick up the path changes made by the python installer
  • Install git-review per
pip install git-review
git clone && scp -p -P 29418 \ copper/.git/hooks/
  • Enter the cloned repo folder and setup git review
git review -s
  • If git review hangs, you might fix this by uninstalling and re-installing git (not sure why this helps, but it did at least once)

Creating a Commit and Gerrit Review

After making some changes in your repo clone:

  • Add the files you changed to the commit list
git add .
  • Commit the changes and edit the commit-msg when vi opens
git commit -sv --signoff --all
(add commit description in first line, e.g. "Add DMZ deployment policy use case.")
(add reference to JIRA issue in 3rd line, e.g. "JIRA: COPPER-3")
(you should see that the --signoff option has resulted in a line being added e.g. \
Signed-off-by: (your gerrit ID) <(your email)>
  • Invoke git review
git review
  • No labels