Search code examples
gitgit-push

Updating Git folder structure on push


I have a Git Repo folder structure as so:

.git
local.repo.only.files
web/
   --Files for remote production

I'm pushing this repo to a remote url, such as dest@git.myhost.com. However, the folder structure there is one file deeper. Essentially just:

--Files on remote production

Is there any way of pushing a specific folder's contents' to a remote?

Up until now, I've been create a nested git init inside the web folder, and pushing just that to the remote. Which has worked... but it's an inelegant solution.


Solution

  • I've been create a nested git init inside the web folder, and pushing just that to the remote. Which has worked... but it's an inelegant solution.

    Either the web folder content is a generated one (one you can rebuild), in which case you don't need a nest git repo, and can deploy your files through rsynch/scp.

    Or you do want a git repo on the remote side, in which case, that remote git repo should be a bare one, with a post-receive hook, which would copy the web subfolder content to your web http server folder.