Git workflow - Setting up a build process

耗尽温柔 提交于 2019-11-26 19:07:43
VonC

It is a best practice to push to a bare repo: see "concept of bare shared repository in git" and all about "bare" repos -- what, why, and how to fix a non-bare push.

Which means on your server, you need to:

  • create a Git repo (you already did)
  • clone that repo a bare repo (git clone --bare yourProjectFolder yourProjectFolder.git)
    (the .git extention is a naming convention for bare repo root folder)
  • push to that bare repo instead:
    Go to your local repo, and type:

    git remote set-url origin /url/repo/repo/yourProjectFolder.git
    
  • add a hook in the bare repo (on the server, yourProjectFolder.git/hooks/post-receive), in which you

    • change directory (to your non-bare repo folder yourProjectFolder)
    • unset GIT_DIR
    • git pull ../yourProjectFolder.git

See more at "Remote nodejs server deployment with forever".

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!