简体   繁体   中英

How to deploy git-versioned web apps through WebDAV?

I have:

  • Mac OS X
  • web app being developed using PHP, etc
  • basic git knowledge;)
  • remote hosting server with WebDav access
  • possibility to manage server files using local git binary via Terminal and WebDav

I don't have:

  • git installed on my remote server
  • ssh access to my remote server

What I do now?

  1. Develop my app locally.
  2. Mount remote server as volume using WebDav (remote files behave like "normal" files in MacOSX)
  3. Copy and replace (upload) my web app to remote server using normal OSX functionality.

What I want to do?

  • Track my web app files using git (git init,add,commit works well as for now)
  • Deploy (upload) my web app to the server using git and WebDav.

What is the best way to achieve these goals? I am able to use local binary of git app on remote files using Terminal and "cd"-ing to them thanks to the mounted WebDav volume. What's next? Do I set up a "git remote" on my local repo and then push changes to the server? Or maybe vice versa, I set up a git remote on my server repo and pull changes from my local repo?

I imagine that I could for example have two deployment directories on the server, one that I push a stable branch to (public accessed website version) and the other one for testing purposes ("unstable branch"). I could easily return to an older version of website if something doesn't work using git...

Thanks in advance for your help, I promise that I tried to find a good solution myself, but didn't find anything that would answer all my questions.

You can huse githooks . They are small scripts that are executed after some actions in git.

For instance, if you want to upload your repository to the webdab folder everytime you commit some changes, you can add a hook on commit with cp -fr /your_git_dir/* /your_webdav_dir/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM