4

I followed the tutorial on this page to make deploying my websites via Git simple: http://toroid.org/ams/git-website-howto. Up til now it's being fine, however I've recently started using Kohana and followed this tutorial to set it up in Git: http://kohanaframework.org/3.1/guide/kohana/tutorials/git.

My problem is: when I push to my web server, none of the submodules are deployed. So, how can I pull the submodules into my working tree on my webserver?

If I run

git --git-dir /srv/www/mysite.com/src/project.git --work-tree /srv/www/mysite.com/public_html submodule init

it says

fatal: working tree '/srv/www/mysite.com/public_html' already exists
Clone of 'git://github.com/kohana/auth.git' into submodule path 'modules/auth' failed`.

Does anyone know how to checkout these submodules? If I can't find a way I'll have to resort to manually FTPing them up which isn't ideal.

1

2 Answers 2

1

You need to push the submodules separately. Submodules are their own repositories.

A simpleminded go at this would be

git sub-module for-each git push

(_add the --recursive flag to make it really work on steroids)

You'd have to look for yourself whether this is what you desire. Also, note that each submodule will push to it's designated upstream (push branch) by default

You can also fetch

Within the receiving worktree:

git submodule update

The first you may have to

git submodule init
5
  • Could I not fetch the submodules on the remote machine? With my working tree there's already a .gitmodules file. Sorry if this is a stupid question. May 3, 2011 at 15:33
  • Yes you can, updating answer (your question was specific about pushing, so I disregarded this; I assumed you were pushing to bare repositories)
    – sehe
    May 3, 2011 at 15:48
  • 1
    My mistake for not being clear :) If you look in the second part of my answer, I'm trying to run git submodule init, but also passing the git dir and work tree locations as I was advised elsewhere as other git says it isn't in a repo. Any idea what's wrong there? May 3, 2011 at 15:55
  • Not really. I must admit that I couldn't read anything - it's a bit of a mess if I might be so blunt. Perhaps I can read it again tonight when I've got some more time
    – sehe
    May 3, 2011 at 16:03
  • Hopefully made it a bit more legible if you do decide to take a look. Cheers. May 3, 2011 at 16:10
0

Try CD'ing into the submodule directory and just doing a git push.

Make sure you did git submodule init and git submodule update in the root project folder when you enabled the submodule.

3
  • On my local repo, I have done init + update so I have a copy of the submodules. If I do git push I can an error saying You can't push to git://github.com/kohana/database.git and if I specify my remotes name it says it doesn't appear to be a git repository. May 3, 2011 at 16:55
  • How did you get the submodules set up in the modules in the first place? When you do a git 'git status' what do you see? May 3, 2011 at 17:33
  • The second link shows the tutorial I followed for adding the submodules (and my git repo structure in general), and the first link shows how I have my git repo set up on my server. git status says everything's clean and git submodules lists all my modules (with git-dir and work-tree args). May 4, 2011 at 7:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.