Remote Git Repository in document root

限于喜欢 提交于 2019-11-30 23:28:42

You have created a bare repository on the server. Bare repositories do not have a working area.

I assume you are trying to use Git for website publishing? See this link for one option. In short:

  • You create 2 repositories on the server. One is a bare repository, just like the one you have already created, but it's outside of the public_html directory
  • Other is a normal repository inside the public_html directory
  • You create a post-receive hook that updates the repository inside the public_html directory whenever you push to the bare repository

You have to clone your repository that you created with git --bare init. See git clone. For example :

1) create a repository with git --bare init in a folder on your server

2) clone that repository somewhere where you want to work with like public_html

3) after you add something new in your clone folder, use:

git add .
git commit -a -m" message for commit "
git push origin master 

And to get the code from your repository use:

git pull origin master 

and that will merge the code from repository with your local branch

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