User Tools

Site Tools


developer:getting_started:windows

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
developer:getting_started:windows [2015/10/29 00:39]
Bryan Sullivan
developer:getting_started:windows [2016/01/07 16:43] (current)
Mark D. Gray
Line 10: Line 10:
  
 ===== Using Git for Windows ===== ===== Using Git for Windows =====
-This procedure ​may be terse, but will be clarified as needed and will be re-tested to make sure nothing is missing ​(steps that I took to get this working may have been forgotten in fumbling toward a solution...).+This procedure will be clarified as needed and will be re-tested to make sure nothing is missing, superfluous,​ or redundantAny input is appreciated.
  
   * Install Putty (the ZIP file or installer package) from http://​www.chiark.greenend.org.uk/​~sgtatham/​putty/​download.html   * Install Putty (the ZIP file or installer package) from http://​www.chiark.greenend.org.uk/​~sgtatham/​putty/​download.html
   * If you don't have a public/​private key pair yet, run PuTTYgen and generate a pair   * 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. https://​gerrit.opnfv.org/​gerrit/#/​settings/​ssh-keys   * 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. https://​gerrit.opnfv.org/​gerrit/#/​settings/​ssh-keys
   * Install Git for Windows from http://​www.git-scm.com/​downloads   * Install Git for Windows from http://​www.git-scm.com/​downloads
Line 30: Line 31:
       <​code>​       <​code>​
       source ~/.bashrc </​code>​       source ~/.bashrc </​code>​
 +  * Create an ssh config file using vi or your editor.
 +    * vi ~/​.ssh/​config
 +      <​code>​
 +      Host (your git/gerrit host, e.g. opnfv.org)
 +        Hostname (your git/gerrit host, e.g. opnfv.org)
 +          User (your gerrit ID)
 +            IdentityFile (path to your private key, e.g. e.g. /​c/​files/​my-key) </​code>​
   * Create/edit your .gitconfig file using vi or your editor.   * Create/edit your .gitconfig file using vi or your editor.
     * vi ~/​.gitconfig     * vi ~/​.gitconfig
Line 38: Line 46:
         required = true         required = true
       [user]       [user]
-        name = (your ID on the gerrit ​server+        name = (your gerrit ​ID
-        email = *(your email)+        email = (your email)
       </​code>​       </​code>​
   * If you are behind a corporate or other proxy, set the proxy in the git config   * If you are behind a corporate or other proxy, set the proxy in the git config
     <​code>​     <​code>​
-    git config --global http.proxy ​=(your proxy, e.g. http://​proxy.example.com:​8080)+    git config --global http.proxy (your proxy, e.g. http://​proxy.example.com:​8080)
     </​code>​     </​code>​
     * 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     * 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
Line 51: Line 59:
       #       proxy = http://​proxy.example.com:​8080       #       proxy = http://​proxy.example.com:​8080
       </​code> ​       </​code> ​
-  * Create an ssh config file using vi or your editor. +  * Add your gerrit ​ID to your git config
-    * vi ~/​.ssh/​config +
-      <​code>​ +
-      Host opnfv.org +
-      Hostname opnfv.org +
-      User (your ID known to the git server) +
-      IdentityFile (path to your private key, e.g. e.g. /​c/​files/​my-key) </​code>​ +
-  * Install Python per https://​www.mediawiki.org/​wiki/​Gerrit/​git-review +
-  *  +
-  * Clone your repo using the "clone with commit-msg hook" URL provided in the gerrit project settings page, e.g. https://​gerrit.opnfv.org/​gerrit/#/​admin/​projects/​copper+
     <​code>​     <​code>​
-    git clone https://​gerrit.opnfv.org/​gerrit/​copper && scp -p -P 29418 blsaws@gerrit.opnfv.org:​hooks/​commit-msg copper/​.git/​hooks/​+    ​git config --global --add gitreview.username "(your gerrit ID)" 
 +    </​code>​ 
 +  * Copy the commit-msg hook to your git config 
 +    <​code>​ 
 +    scp -p -P 29418 (your gerrit ID)@(your gerrit server domain, e.g. gerrit.example.com):​hooks/​commit-msg .git/​hooks/​ 
 +    </​code>​ 
 +  * If you do not have ssh access you can also get this via http 
 +    <​code>​ 
 +    curl -Lo .git/​hooks/​commit-msg gerrit.opnfv.org/​gerrit/​tools/​hooks/​commit-msg 
 +    chmod +x .git/​hooks/​commit-msg</​code>​ 
 +  * Install Python (3.5 or greater) per the "​Windows"​ section of https://​www.mediawiki.org/​wiki/​Gerrit/​git-review 
 +    * 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 https://​www.mediawiki.org/​wiki/​Gerrit/​git-review 
 +    <​code>​ 
 +    pip install git-review 
 +    </​code>​  
 +  * Clone your repo using the "clone with commit-msg hook" URL provided in the gerrit project settings page, e.g. for the OPNFV "​Copper"​ project at https://​gerrit.opnfv.org/​gerrit/#/​admin/​projects/​copper 
 +    <​code>​ 
 +    ​git clone https://​gerrit.opnfv.org/​gerrit/​copper && scp -p -P 29418 
 +      ​blsaws@gerrit.opnfv.org:​hooks/​commit-msg copper/​.git/​hooks/​
     </​code>  ​     </​code>  ​
 +  * Enter the cloned repo folder and setup git review
 +    <​code>​
 +    git review -s
 +    </​code> ​
 +  * 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
 +    <​code>​
 +    git add .
 +    </​code>​
 +  * Commit the changes and edit the commit-msg when vi opens
 +    <​code>​
 +    git commit --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)>
 +    </​code>​
 +  * Invoke git review
 +    <​code>​
 +    git review
 +    </​code>​
 +
developer/getting_started/windows.1446079184.txt.gz · Last modified: 2015/10/29 00:39 by Bryan Sullivan