Few GIT related questions (about submodules)

Hi i just tried git deployment for my website.

However i have a question about the deployment of submodules.

I have a uberspace where i host my website. In the html directory i initialized a git repository which i set as origin in my local repository. If i push the repo to my uberspace submodules don’t get pushed.

How do you keep your submodules in sync between your local and your server repos?

It is right, that pushing to a repository does not change the submodules. You have to run

git submodule foreach git pull

(or even with --recursive) to pull all submodules as well.

My kirby setup at uberspace is the following:

  • I have a git “server” with a bare repository at home
  • I develop on a cloned repository on my local machine
  • The server has a cloned repository too
  • I commit and push some updated code
  • I pull at the server with git pull for the main repository and run the code above for all submodules.

The downside of this is, that I have to log in via ssh for every commit I want at the server. But there is another method to automate this by the “push-to-deploy” techniques. You can add some shell script to your repository that would be executed every time you push to your repository.

This is for my newer projects and seems to be a pretty good way to develop a kirby site for me.

P.S. I also found if quite nice to have the website in a separate folder and do a symlink for every domain. So I can change to a new version, which I have in a separate subdomain, simply by changing the symlink target. (But I also have several services and sites on one uberspace)

2 Likes