Git - pull & push - production server

老子叫甜甜 提交于 2019-12-06 21:03:25
VonC

You should define two remotes:

What I need is a copy on local server where I can develop the site and upload it to the production server

That is a simple

git clone http://www.your_prod_server.com/git/your_bare_repo.git

That will clone the repo and define a remote named "origin". You will be able to push to it because it is a bare repo.
See "all about "bare" repos -- what, why, and how to fix a non-bare push".
See also "GIT: after push, remote repo shows files as deleted" for the danger of pushing to a non-bare repo:

When you push to a remote repo in Git, it does not update the working copy of that remote repo.
This means that the working copy will be out of sync with the last version that you pushed.


There is another guy who can modify the content, so I need to pull the changes too.

You need to add a remote pointing to the "other guy's repo address"

git remote add otherguy http://otherguy_server/other_guy_repo

Even if that colleague's repo isn't bare, you will be able to fetch from it, getting back his changes in your repo, and merging them in your local branch.

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