Deployment with local Git submodules

Here is the current setup. I have a:

  • Central Git repository (origin) on a network drive
  • Working copy on my local hard drive
  • Repository on the web server to deploy project to

I use a submodule to pull in a framework that is hosted on GitHub. My understanding is that when I add a subdmodule to my repository, it downloads the repository from GitHub to my local working directory, where I can then checkout the desired version, and ultimately push to the origin.

  • Automated heroku deploy from subfolder
  • Javascript/CSS File locations for development branch vs production branch
  • Should you recreate containers when deploying web app?
  • Jenkins: Multiple Git repositories for one project
  • Should I deploy my Ruby on Rails application on Heroku
  • git for development and svn on production server
  • When I commit the code to the origin repository, does it push a copy of the framework as well, or does it only, for lack of a better word, store a reference/pointer to the remote repository?

    I ask because I would like to create a few repositories of third-party tools that I often use with this framework (currently not managed with Git), so that I can easily pull them into the projects that need them. The goal is to then update my local, third-party repositories whenever needed and update the individual projects with a newer version.

    The way I deploy my projects is by pushing them to the web server, which will then deploy the application using the post-receive hook. The potential problem might be that if Git doesn’t push the submodule itself and only a pointer, which I think is the case, because that’s what git submodule init && git submodule update is for, the web server will have no way of getting a copy of the submodule’s contents.

    The easiest solution I can think of would be to simply host those third-party tools using a public-facing service like GitHub or Bitbucket, but I’m wondering if there’s another way?

  • Inconsistent information in Git (log vs. diff) about single file
  • Git workflow for different versions of a framework
  • How do I hide/encrypt portions of GIT history?
  • How to merge several subversion remotes into one master branch
  • Git apply a patch to the working directory
  • Visual Studio Online isn't deploying .js files from TypeScript compilation to Azure
  • One Solution collect form web for “Deployment with local Git submodules”

    When I commit the code to the origin repository, does it push a copy of the framework as well, or does it only, for lack of a better word, store a reference/pointer to the remote repository?

    The latter: it store a special entry (as seen here), which means if you have done:

    • any checkout in the submodule (ie. you have changed the HEAD but have not modified any file), you need to go back to the parent repo, add, commit and push that new special entry which reflect the new HEAD SHA1 of your submodule
    • any file modification in your submodule, you need to:
      • add, commit and push that submodule back to its origin
      • go back to the parent repo, add, commit and push.

    Your post-receive hook can take care of a git submodule update --init --recursive step.
    See this hook for instance.

    Git Baby is a git and github fan, let's start git clone.