Difference between revisions of "Git"

From SleuthKitWiki
Jump to: navigation, search
(Created page with "This page outlines how to use git to get the Sleuth Kit source code. It assumes basic familiarity with git, but maybe not all of the nuances of working with git submodules. ...")
 
Line 35: Line 35:
  
 
You will also need to use '--recursive' if you forked the main repository and are working from that.
 
You will also need to use '--recursive' if you forked the main repository and are working from that.
 +
 +
== Updating Code ==
 +
Submodules are not updated automatically when you do a 'git pull' in the sleuthkit repository.  To update all of the modules, you will need to do:
 +
- X 
 +
 +
== Committing Changes to Modules ==
 +
If you want to develop on an official module (c_FooModule for this example) and be able to submit the changes, then follow these steps:
 +
# Fork the main sleuthkit repository into your github account and clone it into a local repository / directory (remember to use --recursive on the clone).
 +
# Fork the c_FooModule repository into your github account.  You don't need to clone this.
 +
# Make the changes to the module in its 'framework/TskModules/c_FooModule' location. Before you make changes, ensure that you are on the master branch using 'git checkout master'.  By default, you are not on master with submodules.
 +
# Commit the module changes by doing a 'git commit' from inside of the c_FooModule directory.
 +
# Push them to the fork in your account by using your fork of c_FooModule as a remote host.
 +
<pre>
 +
git remote add myfork git@github.com:user_name/c_FooModule.git
 +
git push myfork
 +
</pre>
 +
You need to add the remote host only once.
 +
# The previous commit will have updated your sleuthkit repository to reflect the new commit version.  So, you'll need to also do a commit and push to your fork of the sleuthkit repository to your github account.
 +
# Issue pull requests for both the module and sleuthkit repositories.

Revision as of 13:57, 15 May 2012

This page outlines how to use git to get the Sleuth Kit source code. It assumes basic familiarity with git, but maybe not all of the nuances of working with git submodules.


Getting a Read Only Copy of Sleuth Kit Core

If you only want to get a copy of the core TSK (i.e. not the framework) and do not intend to make updates, then clone the main repository:

git clone git://github.com/sleuthkit/sleuthkit.git

This will download the basics of the framework, but not the modules.

Getting a Read/Write Copy of Sleuth Kit Core

If you want to modify the code and submit changes, then fork the github repository into your own github account. Make changes there and submit a pull request.


Sleuth Kit Framework

Submodules

If you want to fully build TSK and the framework, then you'll need to also pull in the submodules. The C++ modules that run inside of the framework are in separate repositories. The framework code uses git submodules to bring those modules into the framework.

For example, the module that opens ZIP files is named c_ZIPExtractionModule. It has its own [ https://github.com/sleuthkit/c_ZIPExtractionModule | repository]. The sleuthkit git repository includes the ZIP extraction module using git submodules into the 'framework/TskModules/c_ZIPExtractionModule' folder. There are several submodules in that folder.

Cloning

To get all of the submodules from the clone, you should use --recursive. For example, to clone the official repo you would use:

git clone --recursive git://github.com/sleuthkit/sleuthkit.git

Otherwise, you will need to use:

git submodule init
git submodule update

You will also need to use '--recursive' if you forked the main repository and are working from that.

Updating Code

Submodules are not updated automatically when you do a 'git pull' in the sleuthkit repository. To update all of the modules, you will need to do: - X

Committing Changes to Modules

If you want to develop on an official module (c_FooModule for this example) and be able to submit the changes, then follow these steps:

  1. Fork the main sleuthkit repository into your github account and clone it into a local repository / directory (remember to use --recursive on the clone).
  2. Fork the c_FooModule repository into your github account. You don't need to clone this.
  3. Make the changes to the module in its 'framework/TskModules/c_FooModule' location. Before you make changes, ensure that you are on the master branch using 'git checkout master'. By default, you are not on master with submodules.
  4. Commit the module changes by doing a 'git commit' from inside of the c_FooModule directory.
  5. Push them to the fork in your account by using your fork of c_FooModule as a remote host.
git remote add myfork git@github.com:user_name/c_FooModule.git
git push myfork

You need to add the remote host only once.

  1. The previous commit will have updated your sleuthkit repository to reflect the new commit version. So, you'll need to also do a commit and push to your fork of the sleuthkit repository to your github account.
  2. Issue pull requests for both the module and sleuthkit repositories.