Deploy a project using Git push

后端 未结 19 1160
囚心锁ツ
囚心锁ツ 2020-11-22 07:06

Is it possible to deploy a website using git push? I have a hunch it has something to do with using git hooks to perform a git reset --hard on the

19条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-22 08:03

    dont install git on a server or copy the .git folder there. to update a server from a git clone you can use following command:

    git ls-files -z | rsync --files-from - --copy-links -av0 . user@server.com:/var/www/project
    

    you might have to delete files which got removed from the project.

    this copies all the checked in files. rsync uses ssh which is installed on a server anyways.

    the less software you have installed on a server the more secure he is and the easier it is to manage it's configuration and document it. there is also no need to keep a complete git clone on the server. it only makes it more complex to secure everything properly.

提交回复
热议问题