Git

Version 8 (Gary Bradski, 2013-10-03 05:50 am)

1 8 Gary Bradski
h1. Get the current OpenCV source code, by cloning the OpenCV git repository
2 1
3 8 Gary Bradski
Use any Git tool (such as the "git" command-line tool, or a GUI tool such as "Git Extensions":http://sourceforge.net/projects/gitextensions/ (Windows), "TortoiseGit":http://code.google.com/p/tortoisegit/ (Windows), "SourceTree":http://www.sourcetreeapp.com/ (Mac), or gitk and git-gui (Linux).
4 8 Gary Bradski
5 7 Gary Bradski
* Main repository (enough for most OpenCV users)
6 5 Gary Bradski
7 1
<pre>git clone git://code.opencv.org/opencv.git</pre>
8 5 Gary Bradski
9 8 Gary Bradski
* Additional repository that contains auxiliary stuff, like big datasets for running the OpenCV tests
10 1
11 5 Gary Bradski
<pre>git clone git://code.opencv.org/opencv_extra.git</pre>
12 5 Gary Bradski
13 8 Gary Bradski
h1. Modify the current OpenCV source code, by pushing your changes to the OpenCV git repository
14 1
15 1
h2. Instruction for Ubuntu users:
16 1
17 1
* Upload shh-key to the server. If you haven't created any, do it with the following command: <pre>ssh-keygen -t rsa -f ~/.ssh/id_rsa</pre> Leave the Passphrase empty. Then copy contents of the file  ~/.ssh/id_rsa.pub to the Key field on the  http://code.opencv.org/my/account page. Press Create. Run <pre>ssh-add ~/.ssh/id_rsa</pre> command. It may be critical on some versions of Ubuntu.
18 1
19 5 Gary Bradski
* Clone the repository as described in the section above. Run the following command in local repository folder to be able to push changes
20 5 Gary Bradski
21 5 Gary Bradski
 <pre>git remote set-url origin --push [email protected]:opencv.git</pre>
22 1
23 1
h2. Instruction for Windows users:
24 1
25 1
* Download and install an up-to-date version of msysgit from its official site: http://code.google.com/p/msysgit/downloads/list. There is also the portable version (_PortableGit-1.7.11-preview20120710.7z_), which you need only to unpack to get access to the console version of Git. Supposing that for some of us it could be quite enough.
26 1
* Download and install the GUI for Git. There are two popular alternatives:
27 1
** TortoiseGit is free, open source (GPL v2). It can be downloaded from http://code.google.com/p/tortoisegit/downloads/list. It has different versions for 32 and 64 bit, so be careful. While installing, locate your msysgit (if it doesn't do that automatically) and choose OpenSHH... (Not PLink... Pytty...!).
28 1
** SmartGit is also free, but for non-commercial use only. Written in Java, which can be installed automatically if needed. SmartGit can be downloaded from: http://www.syntevo.com/smartgit/download.html?all=true.  Portable Archive (includes JRE) is recomended for download. It only requires unpacking and locating msysgit on first launch.
29 1
* Generate SSH access key:
30 1
** Launch Git Bash (file git-bash.bat in msysgit folder).
31 1
** Run <pre>ssh-keygen -t rsa -C  "[email protected]"</pre>  with the console. The output will contain information on where it stored the keys.
32 1
** Go to that directory and open the public key (id_rsa.pub) with any text editor. 
33 1
** Copy contents of the file id_rsa.pub to the Key field on the  http://code.opencv.org/my/account page. Press Create.
34 1
* Clone repository, using 'quick' read-only protocol  (git://code.opencv.org/opencv.git).
35 3 Gary Bradski
* Launch Git Bash again and go to the folder that you've cloned the repository to ('.git' folder should have appeared there). Run the following command: <pre>git remote set-url origin --push [email protected]:opencv.git</pre> to be able to push changes to the repository.
36 1
* That's it. You may try making some changes to commit and push them for the test run.