# Sharing ionic project on git

**URL:** <https://forum.ionicframework.com/t/sharing-ionic-project-on-git/5396>\
**Category:** ionic-v1\
**Created:** [June 9, 2014, 11:57am UTC](https://forum.ionicframework.com/t/sharing-ionic-project-on-git/5396 "2014-06-09T11:57:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jayant](https://avatars.discourse-cdn.com/v4/letter/j/ecb155/32.png) [@jayant](https://forum.ionicframework.com/u/jayant)\
**Post date:** [June 9, 2014, 11:57am UTC](https://forum.ionicframework.com/t/sharing-ionic-project-on-git/5396/1 "2014-06-09T11:57:28Z")

</div>

Hi Ionic team,

Thanks for building this awesome product!

Me and my friend were having some difficulties in sharing the ionic project code over git. Can anyone please suggest **Which files/directories to ignore** and **which to include in git?**.

Also, which commands I need to run to install all the required dependencies on the machine on which I am cloning the project through git?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![jayant](https://avatars.discourse-cdn.com/v4/letter/j/ecb155/32.png) [@jayant](https://forum.ionicframework.com/u/jayant)\
**Post date:** [June 10, 2014, 4:37am UTC](https://forum.ionicframework.com/t/sharing-ionic-project-on-git/5396/2 "2014-06-10T04:37:04Z")

</div>

Any help in this matter will be appreciated!

---

<div class="post-metadata">

**Author:** ![jpsr](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@jpsr](https://forum.ionicframework.com/u/jpsr)\
**Post date:** [August 24, 2014, 2:15pm UTC](https://forum.ionicframework.com/t/sharing-ionic-project-on-git/5396/3 "2014-08-24T14:15:54Z")

</div>

Hello, jayant did you find a solution? I got errors too because some files won’t be tracked by `git add *` in the root folder of the app. These files are missing when we clone the app afterwards.

---

<div class="post-metadata">

**Author:** ![loicknuchel](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/loicknuchel/32/64528_2.png) [@loicknuchel](https://forum.ionicframework.com/u/loicknuchel)\
**Post date:** [August 24, 2014, 2:45pm UTC](https://forum.ionicframework.com/t/sharing-ionic-project-on-git/5396/4 "2014-08-24T14:45:39Z")

</div>

> [@jayant](#):
>
> Which files/directories to ignore

Hi,

Here is my .gitignore :

```auto
app/bower_components/
.sass-cache/
.tmp/
coverage/
hooks/
merges/
node_modules/
platforms/
plugins/
www/
.DS_Store
npm-debug.log

*~

```

And here is my process to get started with commited code :

- go to project root folder
- `npm install` to install all grunt dependencies
- `bower install` to install all bower dependencies
- `grunt serve` to test on your computer

Your app is now running to your computer. To run it to your android device :

- `mkdir platforms plugins www` create folders for cordova
- `cordova platform add android` add android platform to the project
- `cordova plugin add org.apache.cordova.device ...` add interesting plugins
- `grunt build && cordova run android` to run app on your phone

Hope it helps !

---

<div class="post-metadata">

**Author:** ![saurabhgupta050](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/saurabhgupta050/32/6996_2.png) [@saurabhgupta050](https://forum.ionicframework.com/u/saurabhgupta050)\
**Post date:** [May 18, 2015, 7:13am UTC](https://forum.ionicframework.com/t/sharing-ionic-project-on-git/5396/5 "2015-05-18T07:13:10Z")

</div>

Why we need to add hooks/ in .gitignore. Can’t we add scripts here to add platform class or scripts to automatically install plugins from package.json into hooks or is it taken care by ionic cli itself.

---

<div class="post-metadata">

**Author:** ![Alpha\_Nexus](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/alpha_nexus/32/97169_2.png) [@Alpha\_Nexus](https://forum.ionicframework.com/u/Alpha_Nexus)\
**Post date:** [February 19, 2016, 10:12pm UTC](https://forum.ionicframework.com/t/sharing-ionic-project-on-git/5396/6 "2016-02-19T22:12:11Z")

</div>

Yeah I would like to know if anyone has something to do this for a fresh clone?

I had to write a script and include it in the project so new developers can get up and running

```auto
#!/usr/bin/env node
const fs = require('fs');
const exec = require('child_process').exec;

fs.readFile('package.json', function (err, data) {
  if (err) throw err;
  console.log(data);

  const packageJson = JSON.parse(data);
  const cordovaPlatforms = packageJson.cordovaPlatforms;
  const cordovaPlugins = packageJson.cordovaPlugins;

  console.log('installing platforms');
  cordovaPlatforms.forEach(function (platform) {
    console.log('adding platform ' + platform);

    const installCmd = 'ionic platform add ' + platform;
    exec(installCmd, function (err, stdout, stderr) {
      console.log(stdout);
      console.log(stderr);
    });
  });

  console.log('installing plugins');
  cordovaPlugins.forEach(function (plugin) {
    var installCmd;
    if (typeof plugin == 'string') {
      installCmd = 'ionic plugin add ' + plugin;
    } else {
      installCmd = 'ionic plugin add ' + plugin.locator;
    }

    console.log(installCmd);

    exec(installCmd, function (err, stdout, stderr) {
      if (err) {
        console.log(stderr);
        throw err;
      }

      console.log(stdout);
      console.log(stderr);
    });
  });
});

```

It would be better if I wrap the platform installs with a promise first then do the plugin installs, but I didn’t want to add a new dependency to the script. It would also be better if I did something like check if the platform and plugins dirs exist already before running the `add` command.
