Search code examples
gitsshgit-submodulesphpfog

GIT, Private Submodules, and PHPFog


I am trying PHPFog as a host, and I really like how it works.

I'm having an issue, however, with a recent project I pushed. The project contains a submodule, which PHPFog says it supports, however the submodule is a private repository on another server -- requiring an SSH user and password. PHPFog obviously doesn't know that, so the submodule update and init presumtively fails.

Is there a recommended workaround to using private submodules on PHPFog? Can I somehow merge the submodule into the superproject itself and push that way? Or can I reconfigure the submodule to include the SSH login information, allowing PHPfog to successfully initialize it?

EDIT: As a quick fix: I cloned into a temp directory, deleted the git folders in the submodule, and uploaded as a single repo to phpFog. This isn't the ideal solution I'm looking for.


Solution

  • There is a new tool that allows pushing of apps with git submodules to PHP Fog. Normal git pushes will no longer fetch submodules for you and your app will fail to deploy.

    See: PHP Fog's PF CLI

    To push an app with git submodules first setup your account.

    pf setup
    

    List your apps to verify your logged in and get the ID of the app to clone.

    pf list apps
    

    Clone the app using the pf tool. Be sure to backup your existing git folder.

    pf clone <app_id> <folder>
    

    Here is the key to getting submodules working: You must use the update command and not the push command from now on to deploy.

    pf update
    

    Notes: The pf setup command will setup a new ssh key and automatically upload it for you. It also creates a new alias in the ssh/config for this. After using this tool you must use it for cloning your apps although you still use git commands for adding and committing changes. If you are using git submodules you have to use pf update, git push will break your app.